-
-
Notifications
You must be signed in to change notification settings - Fork 676
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
Partially revert 3af1853260 to fix use-after-free #2265
Conversation
After upgrading to the latest release of Waybar the bar will crash whenever I close the laptop lid. After some debugging I believe it is because the watching added by watch_name is not being correctly canceled using unwatch_name. After the Tray object and Host object are destroyed, additional callbacks will become use-after-free. Looks like commit 3af1853 removed the unwatch_name. I'm not sure why it did that, but it seemed dangerous. Additionally, bus_name_id_ is created by own_name. According to that function's documentation, the correct inverse operation is unown_name.
This commit was done due to in normal mode each destructor is responsible for resources cleaning for the particular class. For example, watcher should destroy resources that belong to the watcher instance. The same for host. Otherwise, waybar spoiles warning about its impossible to unown resource. |
@LukashonakV FWIW I think I was actually following your comment in this PR. So the
Could you clarify which resource this is talking about? Is it about the |
Hi @tengyifei I would be able to check next week. Still on vacation) |
Thanks of course -- it's not urgent. I'm running a locally compiled waybar which fixed the crash for me in the meantime. |
I'll merge this PR in order to publish a new Waybar update. |
After upgrading to the latest release of Waybar the bar will crash whenever I close the laptop lid. After some debugging I believe it is because the watching added by
watch_name
inHost
is not being correctly canceled usingunwatch_name
. After the Tray object and Host object are destroyed, additional callbacks will become use-after-free.Apparently commit 3af1853 removed the
unwatch_name
. I'm not sure why it did that, but it seems dangerous.Additionally, bus_name_id_ is created by own_name. According to that function's documentation, the correct inverse operation is unown_name.