File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -37,17 +37,15 @@ public class Gala.HideTracker : Object {
3737 Object (display: display, panel: panel);
3838 }
3939
40- ~HideTracker () {
41- if (hide_timeout_id != 0 ) {
42- Source . remove (hide_timeout_id);
43- }
44-
45- if (update_timeout_id != 0 ) {
46- Source . remove (update_timeout_id);
47- }
48- }
49-
5040 construct {
41+ panel. window. unmanaging. connect_after (() = > {
42+ // The timeouts hold refs on us so we stay connected to signal handlers that might
43+ // access the panel which was already freed. To prevent that make sure we reset
44+ // the timeouts so that we get freed immediately
45+ reset_hide_timeout ();
46+ reset_update_timeout ();
47+ });
48+
5149 // Can't be local otherwise we get a memory leak :(
5250 // See https://gitlab.gnome.org/GNOME/vala/-/issues/1548
5351 current_focus_window = display. focus_window;
@@ -152,6 +150,13 @@ public class Gala.HideTracker : Object {
152150 });
153151 }
154152
153+ private void reset_update_timeout () {
154+ if (update_timeout_id != 0 ) {
155+ Source . remove (update_timeout_id);
156+ update_timeout_id = 0 ;
157+ }
158+ }
159+
155160 public void update_overlap () {
156161 overlap = false ;
157162 focus_overlap = false ;
You can’t perform that action at this time.
0 commit comments