Fix crash when using tiling shortcuts (#2040)

Co-authored-by: Danielle Foré <danielle@elementary.io>
Co-authored-by: Ryan Kornheisl <ryan@skarva.tech>
Co-authored-by: Leonhard <106322251+leolost2605@users.noreply.github.com>
This commit is contained in:
Leo 2024-12-11 18:29:42 +03:00 committed by GitHub
parent 903bc3fd77
commit 0442e96796
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);