Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wm: fixed segmentation fault in wm_find_leader #1336

Closed
wants to merge 1 commit into from

Conversation

Monsterovich
Copy link
Contributor

@Monsterovich Monsterovich commented Sep 9, 2024

I triggered this by simply opening OpenMPT, which first shows the application logo and then opens the main window.

Program received signal SIGSEGV, Segmentation fault.
0x00005555555db17d in wm_find_leader (wm=0x5555556c1470, node=0x0) at ../src/wm/wm.c:212
212             if (node->leader_final != NULL) {
(gdb) back
#0  0x00005555555db17d in wm_find_leader (wm=0x5555556c1470, node=0x0) at ../src/wm/wm.c:212
#1  0x00005555555db28b in wm_find_leader (wm=0x5555556c1470, node=0x5555556ebab0) at ../src/wm/wm.c:229
#2  0x00005555555db39e in wm_refresh_leaders (wm=0x5555556c1470) at ../src/wm/wm.c:251
#3  0x0000555555593b97 in refresh_windows (ps=0x5555556b6580) at ../src/picom.c:1625
#4  0x0000555555593d3b in handle_pending_updates (ps=0x5555556b6580, delta_t=0.014999999999999999) at ../src/picom.c:1662
#5  0x00005555555942b0 in draw_callback_impl (loop=0x7ffff7ea8720, ps=0x5555556b6580, revents=256) at ../src/picom.c:1732
#6  0x0000555555594e13 in draw_callback (loop=0x7ffff7ea8720, w=0x5555556b65e0, revents=256) at ../src/picom.c:1933
#7  0x00007ffff7e9c773 in ev_invoke_pending () from /lib/x86_64-linux-gnu/libev.so.4
#8  0x00007ffff7ea0041 in ev_run () from /lib/x86_64-linux-gnu/libev.so.4
#9  0x00005555555995eb in session_run (ps=0x5555556b6580) at ../src/picom.c:2746
#10 0x0000555555599972 in main (argc=1, argv=0x7fffffffe358) at ../src/picom.c:2861

@yshui
Copy link
Owner

yshui commented Sep 9, 2024

thanks for reporting. so basically what happened is we tried to refresh leader before the window tree is consistent.

your fix is not sufficient, and there are other places where crash could happen too, e.g. ... (sorry, wrong example).

but the more important problem here is the window's leader will be wrong.

i will try to find the correct fix. closing this for now.

@yshui yshui closed this Sep 9, 2024
@Monsterovich Monsterovich deleted the feat-fix-wm-segfault branch September 9, 2024 23:17
yshui added a commit that referenced this pull request Sep 9, 2024
The leader nodes referenced might not be in the tree yet.

Fixes #1336

Signed-off-by: Yuxuan Shui <[email protected]>
yshui added a commit that referenced this pull request Sep 10, 2024
On second thought, it is not very nice to give up as soon as we see the
tree being inconsistent. This could results in flickering, etc.

Instead, still refresh the leaders with best effort. And only set the
flag to retry leader refresh when we actually hit an inconsistent tree
node.

Related #1336

Signed-off-by: Yuxuan Shui <[email protected]>
yshui added a commit that referenced this pull request Sep 10, 2024
On second thought, it is not very nice to give up as soon as we see the
tree being inconsistent. This could results in flickering, etc.

Instead, still refresh the leaders with best effort. And only set the
flag to retry leader refresh when we actually hit an inconsistent tree
node.

Related #1336

Signed-off-by: Yuxuan Shui <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants