Skip to content

Commit 08e78d6

Browse files
authored
WindowSwitcher: Fix crash (#2361)
1 parent 94ef835 commit 08e78d6

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/Widgets/WindowSwitcher/WindowSwitcher.vala

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@ public class Gala.WindowSwitcher : CanvasActor, GestureTarget {
4242
_current_icon = value;
4343
if (_current_icon != null) {
4444
_current_icon.selected = true;
45-
46-
// _current_icon.grab_key_focus () sometimes results in a crash
47-
// https://github.com/elementary/gala/issues/2308
48-
get_stage ().set_key_focus (_current_icon);
45+
_current_icon.grab_key_focus ();
4946
}
5047

5148
update_caption_text ();
@@ -334,15 +331,14 @@ public class Gala.WindowSwitcher : CanvasActor, GestureTarget {
334331
}
335332

336333
private bool collect_all_windows (Meta.Display display, Meta.Workspace? workspace) {
334+
container.remove_all_children ();
337335
select_icon (null);
338336

339337
var windows = display.get_tab_list (Meta.TabList.NORMAL, workspace);
340338
if (windows == null) {
341339
return false;
342340
}
343341

344-
container.remove_all_children ();
345-
346342
unowned var current_window = display.get_tab_current (Meta.TabList.NORMAL, workspace);
347343
foreach (unowned var window in windows) {
348344
var icon = new WindowSwitcherIcon (window, ICON_SIZE, scaling_factor);
@@ -357,6 +353,7 @@ public class Gala.WindowSwitcher : CanvasActor, GestureTarget {
357353
}
358354

359355
private bool collect_current_windows (Meta.Display display, Meta.Workspace? workspace) {
356+
container.remove_all_children ();
360357
select_icon (null);
361358

362359
var windows = display.get_tab_list (Meta.TabList.NORMAL, workspace);
@@ -369,8 +366,6 @@ public class Gala.WindowSwitcher : CanvasActor, GestureTarget {
369366
return false;
370367
}
371368

372-
container.remove_all_children ();
373-
374369
unowned var window_tracker = ((WindowManagerGala) wm).window_tracker;
375370
var app = window_tracker.get_app_for_window (current_window);
376371
foreach (unowned var window in windows) {

0 commit comments

Comments
 (0)