Skip to content

Commit 0442e96

Browse files
lenemterdanirabbitzeebokleolost2605
authored
Fix crash when using tiling shortcuts (#2040)
Co-authored-by: Danielle Foré <[email protected]> Co-authored-by: Ryan Kornheisl <[email protected]> Co-authored-by: Leonhard <[email protected]>
1 parent 903bc3f commit 0442e96

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/WindowManager.vala

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ namespace Gala {
9797
#else
9898
private Meta.Rectangle old_rect_size_change;
9999
#endif
100-
private Clutter.Actor latest_window_snapshot;
100+
private Clutter.Actor? latest_window_snapshot;
101101

102102
private GLib.Settings behavior_settings;
103103
private GLib.Settings new_behavior_settings;
@@ -1402,13 +1402,13 @@ namespace Gala {
14021402
latest_window_snapshot.restore_easing_state ();
14031403

14041404
ulong maximize_old_handler_id = 0UL;
1405-
maximize_old_handler_id = latest_window_snapshot.transitions_completed.connect (() => {
1406-
latest_window_snapshot.disconnect (maximize_old_handler_id);
1407-
latest_window_snapshot.destroy ();
1405+
maximize_old_handler_id = latest_window_snapshot.transitions_completed.connect ((snapshot) => {
1406+
snapshot.disconnect (maximize_old_handler_id);
1407+
snapshot.destroy ();
14081408
actor.set_translation (0.0f, 0.0f, 0.0f);
14091409
});
14101410

1411-
latest_window_snapshot.restore_easing_state ();
1411+
latest_window_snapshot = null;
14121412

14131413
actor.set_pivot_point (0.0f, 0.0f);
14141414
actor.set_translation (old_rect_size_change.x - ex, old_rect_size_change.y - ey, 0.0f);
@@ -1775,11 +1775,13 @@ namespace Gala {
17751775
latest_window_snapshot.restore_easing_state ();
17761776

17771777
ulong unmaximize_old_handler_id = 0UL;
1778-
unmaximize_old_handler_id = latest_window_snapshot.transitions_completed.connect (() => {
1779-
latest_window_snapshot.disconnect (unmaximize_old_handler_id);
1780-
latest_window_snapshot.destroy ();
1778+
unmaximize_old_handler_id = latest_window_snapshot.transitions_completed.connect ((snapshot) => {
1779+
snapshot.disconnect (unmaximize_old_handler_id);
1780+
snapshot.destroy ();
17811781
});
17821782

1783+
latest_window_snapshot = null;
1784+
17831785
actor.set_pivot_point (0.0f, 0.0f);
17841786
actor.set_position (ex, ey);
17851787
actor.set_translation (-ex + offset_x * (1.0f / scale_x - 1.0f) + old_rect_size_change.x, -ey + offset_y * (1.0f / scale_y - 1.0f) + old_rect_size_change.y, 0.0f);

0 commit comments

Comments
 (0)