Skip to content

Commit

Permalink
Remove idle when the object is destroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
lenemter committed Dec 19, 2024
1 parent ebba18d commit e10f81d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/WindowActorFetcher.vala
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,30 @@ public class Gala.WindowActorFetcher : GLib.Object {

public Meta.Window window { get; construct; }

private uint idle_id = 0;

public WindowActorFetcher (Meta.Window window) {
Object (window: window);
}

~WindowActorFetcher () {
if (idle_id > 0) {
Source.remove (idle_id);
}
}

construct {
Idle.add (() => {
idle_id = Idle.add (() => {
if (window == null) {
idle_id = 0;
return Source.REMOVE;
}

unowned var window_actor = (Meta.WindowActor) window.get_compositor_private ();

if (window_actor != null) {
window_actor_ready ();
idle_id = 0;

return Source.REMOVE;
}
Expand Down

0 comments on commit e10f81d

Please sign in to comment.