Skip to content

Commit 34ca30c

Browse files
authored
Merge branch 'main' into lenemter/dock-workspace-switcher-pof
2 parents 0669c0a + ef6292a commit 34ca30c

File tree

3 files changed

+29
-15
lines changed

3 files changed

+29
-15
lines changed

src/ShellClients/HideTracker.vala

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff 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;

src/ShellClients/NotificationsClient.vala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public class Gala.NotificationsClient : Object {
2020
client.window_created.connect ((window) => {
2121
window.set_data (NOTIFICATION_DATA_KEY, true);
2222
window.make_above ();
23+
window.stick ();
2324
#if HAS_MUTTER46
2425
client.wayland_client.make_dock (window);
2526
#endif

src/WorkspaceManager.vala

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public class Gala.WorkspaceManager : Object {
8585
return;
8686
}
8787

88-
workspace.window_added.connect (window_added);
88+
workspace.window_added.connect (queue_window_added);
8989
workspace.window_removed.connect (window_removed);
9090
}
9191

@@ -124,9 +124,15 @@ public class Gala.WorkspaceManager : Object {
124124
}
125125
}
126126

127-
private void window_added (Meta.Workspace? workspace, Meta.Window window) {
127+
private void queue_window_added (Meta.Workspace? workspace, Meta.Window window) {
128+
// We get this call very early so we have to queue an idle for ShellClients
129+
// that might not have checked the window/got a protocol call yet
130+
Idle.add (() => window_added (workspace, window));
131+
}
132+
133+
private bool window_added (Meta.Workspace? workspace, Meta.Window window) {
128134
if (workspace == null || !Meta.Prefs.get_dynamic_workspaces () || window.on_all_workspaces) {
129-
return;
135+
return Source.REMOVE;
130136
}
131137

132138
unowned Meta.WorkspaceManager manager = workspace.get_display ().get_workspace_manager ();
@@ -139,6 +145,8 @@ public class Gala.WorkspaceManager : Object {
139145
) {
140146
append_workspace ();
141147
}
148+
149+
return Source.REMOVE;
142150
}
143151

144152
private void window_removed (Meta.Workspace? workspace, Meta.Window window) {
@@ -185,7 +193,7 @@ public class Gala.WorkspaceManager : Object {
185193

186194
private void window_entered_monitor (Meta.Display display, int monitor, Meta.Window window) {
187195
if (InternalUtils.workspaces_only_on_primary () && monitor == display.get_primary_monitor ()) {
188-
window_added (window.get_workspace (), window);
196+
queue_window_added (window.get_workspace (), window);
189197
}
190198
}
191199

@@ -243,7 +251,7 @@ public class Gala.WorkspaceManager : Object {
243251
return;
244252
}
245253

246-
workspace.window_added.disconnect (window_added);
254+
workspace.window_added.disconnect (queue_window_added);
247255
workspace.window_removed.disconnect (window_removed);
248256

249257
workspaces_marked_removed.add (workspace);

0 commit comments

Comments
 (0)