mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
idle-monitor: Reset timeout before firing watch
The watch might be removed during firing, meaning the source is destroyed after returning. Avoid use-after-free by unsetting the timeout before firing. Returning G_SOURCE_CONTINUE in that case is harmless, as source is destroyed. Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/796 https://gitlab.gnome.org/GNOME/mutter/merge_requests/799
This commit is contained in:
parent
26b08d87a8
commit
0e69fe0781
@ -324,9 +324,10 @@ idle_monitor_dispatch_timeout (GSource *source,
|
|||||||
if (ready_time > now)
|
if (ready_time > now)
|
||||||
return G_SOURCE_CONTINUE;
|
return G_SOURCE_CONTINUE;
|
||||||
|
|
||||||
meta_idle_monitor_watch_fire (watch);
|
|
||||||
g_source_set_ready_time (watch->timeout_source, -1);
|
g_source_set_ready_time (watch->timeout_source, -1);
|
||||||
|
|
||||||
|
meta_idle_monitor_watch_fire (watch);
|
||||||
|
|
||||||
return G_SOURCE_CONTINUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user