From 0442e967962b18c91e2241e334b15cab0f8d7106 Mon Sep 17 00:00:00 2001 From: Leo Date: Wed, 11 Dec 2024 18:29:42 +0300 Subject: [PATCH] Fix crash when using tiling shortcuts (#2040) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Danielle Foré Co-authored-by: Ryan Kornheisl Co-authored-by: Leonhard <106322251+leolost2605@users.noreply.github.com> --- src/WindowManager.vala | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/WindowManager.vala b/src/WindowManager.vala index 37d69c63..0819e992 100644 --- a/src/WindowManager.vala +++ b/src/WindowManager.vala @@ -97,7 +97,7 @@ namespace Gala { #else private Meta.Rectangle old_rect_size_change; #endif - private Clutter.Actor latest_window_snapshot; + private Clutter.Actor? latest_window_snapshot; private GLib.Settings behavior_settings; private GLib.Settings new_behavior_settings; @@ -1402,13 +1402,13 @@ namespace Gala { latest_window_snapshot.restore_easing_state (); ulong maximize_old_handler_id = 0UL; - maximize_old_handler_id = latest_window_snapshot.transitions_completed.connect (() => { - latest_window_snapshot.disconnect (maximize_old_handler_id); - latest_window_snapshot.destroy (); + maximize_old_handler_id = latest_window_snapshot.transitions_completed.connect ((snapshot) => { + snapshot.disconnect (maximize_old_handler_id); + snapshot.destroy (); actor.set_translation (0.0f, 0.0f, 0.0f); }); - latest_window_snapshot.restore_easing_state (); + latest_window_snapshot = null; actor.set_pivot_point (0.0f, 0.0f); actor.set_translation (old_rect_size_change.x - ex, old_rect_size_change.y - ey, 0.0f); @@ -1775,11 +1775,13 @@ namespace Gala { latest_window_snapshot.restore_easing_state (); ulong unmaximize_old_handler_id = 0UL; - unmaximize_old_handler_id = latest_window_snapshot.transitions_completed.connect (() => { - latest_window_snapshot.disconnect (unmaximize_old_handler_id); - latest_window_snapshot.destroy (); + unmaximize_old_handler_id = latest_window_snapshot.transitions_completed.connect ((snapshot) => { + snapshot.disconnect (unmaximize_old_handler_id); + snapshot.destroy (); }); + latest_window_snapshot = null; + actor.set_pivot_point (0.0f, 0.0f); actor.set_position (ex, ey); 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);