Skip to content

Commit

Permalink
ShellClients: Fix memory leak and crash (#2028)
Browse files Browse the repository at this point in the history
  • Loading branch information
leolost2605 authored Aug 16, 2024
1 parent a6100e0 commit e994d58
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/ShellClients/CenteredWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ public class Gala.CenteredWindow : Object {

window.shown.connect (() => window.focus (wm.get_display ().get_current_time ()));

window.unmanaging.connect (() => Source.remove (idle_move_id));
window.unmanaging.connect (() => {
if (idle_move_id != 0) {
Source.remove (idle_move_id);
}
});
}

private void position_window () {
Expand All @@ -37,7 +41,6 @@ public class Gala.CenteredWindow : Object {
var x = monitor_geom.x + (monitor_geom.width - window_rect.width) / 2;
var y = monitor_geom.y + (monitor_geom.height - window_rect.height) / 2;


if (idle_move_id != 0) {
Source.remove (idle_move_id);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ShellClients/HideTracker.vala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Gala.HideTracker : Object {
public signal void show ();

public Meta.Display display { get; construct; }
public PanelWindow panel { get; construct; }
public unowned PanelWindow panel { get; construct; }
public Pantheon.Desktop.HideMode hide_mode { get; set; default = NEVER; }

private bool hovered = false;
Expand Down
2 changes: 1 addition & 1 deletion src/ShellClients/PanelClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class Gala.PanelClone : Object {
private const int ANIMATION_DURATION = 250;

public WindowManager wm { get; construct; }
public PanelWindow panel { get; construct; }
public unowned PanelWindow panel { get; construct; }

public Pantheon.Desktop.HideMode hide_mode {
get {
Expand Down
4 changes: 3 additions & 1 deletion src/ShellClients/PanelWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ public class Gala.PanelWindow : Object {
window.size_changed.connect (position_window);

window.unmanaging.connect (() => {
Source.remove (idle_move_id);
if (idle_move_id != 0) {
Source.remove (idle_move_id);
}

destroy_barrier ();

Expand Down

0 comments on commit e994d58

Please sign in to comment.