Skip to content

Commit e10f81d

Browse files
committed
Remove idle when the object is destroyed
1 parent ebba18d commit e10f81d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/WindowActorFetcher.vala

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,30 @@ public class Gala.WindowActorFetcher : GLib.Object {
1212

1313
public Meta.Window window { get; construct; }
1414

15+
private uint idle_id = 0;
16+
1517
public WindowActorFetcher (Meta.Window window) {
1618
Object (window: window);
1719
}
1820

21+
~WindowActorFetcher () {
22+
if (idle_id > 0) {
23+
Source.remove (idle_id);
24+
}
25+
}
26+
1927
construct {
20-
Idle.add (() => {
28+
idle_id = Idle.add (() => {
2129
if (window == null) {
30+
idle_id = 0;
2231
return Source.REMOVE;
2332
}
2433

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

2736
if (window_actor != null) {
2837
window_actor_ready ();
38+
idle_id = 0;
2939

3040
return Source.REMOVE;
3141
}

0 commit comments

Comments
 (0)