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

win: don't re-bind mask image when there is already one #1078

Merged
merged 2 commits into from
Jun 29, 2023

Conversation

Monsterovich
Copy link
Contributor

@Monsterovich Monsterovich commented Jun 18, 2023

For some reason, it may happen that mask_image exists, causing a memory leak in win_bind_mask. Since assert(!w->mask_image); has been added, there are random crashes.

Direct leak of 56 byte(s) in 1 object(s) allocated from:
    #0 0x7fa0f26b4a37 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x555f7f92138c in default_new_backend_image ../src/backend/backend_common.c:497
    #2 0x555f7f961d4c in gl_make_mask ../src/backend/gl/gl_common.c:712
    #3 0x555f7f81f73e in win_bind_mask ../src/win.c:353
    #4 0x555f7f94ee79 in paint_all_new ../src/backend/backend.c:235
    #5 0x555f7f7f4dda in draw_callback_impl ../src/picom.c:1830
    #6 0x555f7f7f531b in draw_callback ../src/picom.c:1858
    #7 0x7fa0f3078772 in ev_invoke_pending (/lib/x86_64-linux-gnu/libev.so.4+0x5772)

It happens randomly, so this bug is hard to catch.

I just did like this: backend.c The crashes seem to be gone.

@absolutelynothelix
Copy link
Collaborator

it may be a good solution just to avoid crashes but we still need to figure out why exactly this happens because it may hide a bigger issue (see #1035, for example). i'd add a warning printed when refusing to bind a mask because it's already bound so this issue won't be forgotten.

and if you plan on contributing continuously, do something with these garbage merge commits.

src/win.c Show resolved Hide resolved
@yshui yshui changed the title Fixed mask image creation issues win: don't re-bind mask image when there is already one Jun 29, 2023
@yshui yshui merged commit 4e6dddc into yshui:next Jun 29, 2023
11 of 13 checks passed
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.

None yet

3 participants