Skip to content

window-list: fix panel crash when child toplevel changes parent - #561

Open
mrsteve0924 wants to merge 2 commits into
WayfireWM:masterfrom
mrsteve0924:panel-crash
Open

mrsteve0924 wants to merge 2 commits into
WayfireWM:masterfrom
mrsteve0924:panel-crash

Conversation

@mrsteve0924

@mrsteve0924 mrsteve0924 commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Panel will crash when clicking on an open app in the window-list.
Mostly happens when opening a file from thunar then clicking on the thunar window-list widget.

Remove a child from its previous parent when its parent changes.
Also avoid dereferencing stale child entries when handling window-list clicks.

Panel will crash when clicking on an open app in the window-list.
Mostly happens when opening a file from thunar then clicking on the
thunar window-list widget.

Remove a child from its previous parent when its parent changes. Also avoid
dereferencing stale child entries when handling window-list clicks.

Assisted-by: ChatGPT:GPT-5.6 Sol
Signed-off-by: steve finkel <mrsteve0924@verizon.net>
@mrsteve0924

mrsteve0924 commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author

the crash is difficult to reproduce. i was able to crash the panel again, but using different click patterns on the window-list widget. here is the backtrace (link below).

https://dpaste.com//EL6JGPUBE#wrap

@mrsteve0924

mrsteve0924 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor Author

EDIT: turns out this bad behavior is not caused by this commit. It is caused by changing a setting in wf-shell.ini and then not restarting the panel. the overlap exists with settings change on current master 01c1a9d. ill reopen this PR.

i've noticed that with this commit that when several window-list items are near the right side of the panel, showing a new command-output widget caused it to overlap an existing window-list item instead of pushing the window list left and resizing normally. Looks like commenting out the new remove_child_from_parent(impl, handle); call made the layout behave correctly again.

However, the crash is still prevented by the defensive lookup in on_clicked():
auto it = window_list->toplevels.find(c);
if ((it != window_list->toplevels.end()) && it->second &&
(it->second->get_state() & WF_TOPLEVEL_STATE_ACTIVATED))

I am going to move this to a draft for the time being to test some more.
panel_overlap

@mrsteve0924
mrsteve0924 marked this pull request as draft September 27, 2026 01:05
@mrsteve0924
mrsteve0924 marked this pull request as ready for review September 28, 2026 00:25
Right-clicking an application icon in the Wayfire application menu
caused wf-panel to crash when the application's desktop file did not
define any actions.

Only open the extra-actions popover when actions are available. Apply
the same check to long-press handling.

Assisted-by: ChatGPT:GPT-5.6 Sol
Signed-off-by: steve finkel <mrsteve0924@verizon.net>
@trigg trigg added the LGTM Looks good to me! On last check, good to merge label Oct 20, 2026
@borisi1

borisi1 commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

I ran into the same crash on wf-shell master f317d07 (Debian 13, wayfire 0.12.0-dev): wf-panel segfaulted in WayfireToplevel::impl::on_drag_end() while an external monitor was unplugged and plugged back in. The build has no debug symbols, but the disassembly at the crash point shows the toplevels[c] lookup in on_clicked() returning an empty entry, which is exactly what this PR fixes:

Stack trace of the crashing thread (systemd-coredump)
#0  0x00005566b3bdf8fc _ZN15WayfireToplevel4impl11on_drag_endEdd (/usr/local/bin/wf-panel + 0xbe8fc)
#1  0x00007fd2100b6d76 n/a (libgtkmm-4.0.so.0 + 0x2b6d76)
#2  0x00007fd20eedff9a n/a (libgtk-4.so.1 + 0xdff9a)
#3  0x00007fd2103a0b81 n/a (libgobject-2.0.so.0 + 0x17b81)
#4  0x00007fd2103b68b8 n/a (libgobject-2.0.so.0 + 0x2d8b8)
#5  0x00007fd2103bc5a6 g_signal_emit_valist (libgobject-2.0.so.0 + 0x335a6)
#6  0x00007fd2103bc663 g_signal_emit (libgobject-2.0.so.0 + 0x33663)
#7  0x00007fd2103a3d81 g_cclosure_marshal_VOID__BOXEDv (libgobject-2.0.so.0 + 0x1ad81)
#8  0x00007fd2103a0b81 n/a (libgobject-2.0.so.0 + 0x17b81)
#9  0x00007fd2103b68b8 n/a (libgobject-2.0.so.0 + 0x2d8b8)
#10 0x00007fd2103bc5a6 g_signal_emit_valist (libgobject-2.0.so.0 + 0x335a6)
#11 0x00007fd2103bc663 g_signal_emit (libgobject-2.0.so.0 + 0x33663)
#12 0x00007fd20ef9851b n/a (libgtk-4.so.1 + 0x19851b)
#13 0x00007fd20ef99ceb n/a (libgtk-4.so.1 + 0x199ceb)
#14 0x00007fd20ef9ccfe n/a (libgtk-4.so.1 + 0x19ccfe)
#15 0x00007fd20ef675ae n/a (libgtk-4.so.1 + 0x1675ae)
#16 0x00007fd20f0c089c n/a (libgtk-4.so.1 + 0x2c089c)
#17 0x00007fd20efdd83e n/a (libgtk-4.so.1 + 0x1dd83e)
#18 0x00007fd20efddda3 n/a (libgtk-4.so.1 + 0x1ddda3)
#19 0x00007fd20f268762 n/a (libgtk-4.so.1 + 0x468762)
#20 0x00007fd20f30115d n/a (libgtk-4.so.1 + 0x50115d)
#21 0x00007fd2103a0b81 n/a (libgobject-2.0.so.0 + 0x17b81)
#22 0x00007fd2103b5b33 n/a (libgobject-2.0.so.0 + 0x2cb33)
#23 0x00007fd2103bc5a6 g_signal_emit_valist (libgobject-2.0.so.0 + 0x335a6)
#24 0x00007fd2103bc663 g_signal_emit (libgobject-2.0.so.0 + 0x33663)
#25 0x00007fd20f30510b n/a (libgtk-4.so.1 + 0x50510b)
#26 0x00007fd20f27f52e n/a (libgtk-4.so.1 + 0x47f52e)
#27 0x00007fd20fd03485 n/a (libglib-2.0.so.0 + 0x5c485)
#28 0x00007fd20fd056b7 n/a (libglib-2.0.so.0 + 0x5e6b7)
#29 0x00007fd20fd05e20 g_main_context_iteration (libglib-2.0.so.0 + 0x5ee20)
#30 0x00007fd20ecf2f1d g_application_run (libgio-2.0.so.0 + 0xeaf1d)
#31 0x00005566b3b95119 main (/usr/local/bin/wf-panel + 0x74119)
gdb at the crash point (core dump)
   <on_drag_end+944>: call  std::_Rb_tree<zwlr_foreign_toplevel_handle_v1*, std::pair<…, std::unique_ptr<WayfireToplevel>>, …>::_M_emplace_hint_unique<…piecewise_construct…>
   <on_drag_end+949>: mov   %rax,%rsi
   <on_drag_end+952>: mov   0x28(%rsi),%rax
=> <on_drag_end+956>: mov   (%rax),%rax
   <on_drag_end+959>: testb $0x1,0x30(%rax)

rax            0x0                 0

_M_emplace_hint_unique is operator[] inserting a new entry for a child handle that wasn't in toplevels; the loaded unique_ptr is null and get_state() dereferences it.

I'm running the window-list part of this PR locally now (on top of f317d07); the panel survives monitor replugs so far. Thanks for the fix, it would be great to see it merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LGTM Looks good to me! On last check, good to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants