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

HideTracker: Disconnect timeouts on unmanaging #2272

Merged
merged 1 commit into from
Feb 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions src/ShellClients/HideTracker.vala
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,15 @@ public class Gala.HideTracker : Object {
Object (display: display, panel: panel);
}

~HideTracker () {
if (hide_timeout_id != 0) {
Source.remove (hide_timeout_id);
}

if (update_timeout_id != 0) {
Source.remove (update_timeout_id);
}
}

construct {
panel.window.unmanaging.connect_after (() => {
// The timeouts hold refs on us so we stay connected to signal handlers that might
// access the panel which was already freed. To prevent that make sure we reset
// the timeouts so that we get freed immediately
reset_hide_timeout ();
reset_update_timeout ();
});

// Can't be local otherwise we get a memory leak :(
// See https://gitlab.gnome.org/GNOME/vala/-/issues/1548
current_focus_window = display.focus_window;
Expand Down Expand Up @@ -152,6 +150,13 @@ public class Gala.HideTracker : Object {
});
}

private void reset_update_timeout () {
if (update_timeout_id != 0) {
Source.remove (update_timeout_id);
update_timeout_id = 0;
}
}

public void update_overlap () {
overlap = false;
focus_overlap = false;
Expand Down