aboutsummaryrefslogtreecommitdiffstats
path: root/src/event/TimeoutMonitor.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-04-08 23:14:07 +0200
committerMax Kellermann <max@duempel.org>2013-04-08 23:14:07 +0200
commit98cbc0ea79ce5bea637f7bd7ebe94e698cd818a0 (patch)
treea514f72181ce9b3158b25a1c5778c4477062dc06 /src/event/TimeoutMonitor.cxx
parentdca111519627813608807b60b98f3d5133880120 (diff)
downloadmpd-98cbc0ea79ce5bea637f7bd7ebe94e698cd818a0.tar.gz
mpd-98cbc0ea79ce5bea637f7bd7ebe94e698cd818a0.tar.xz
mpd-98cbc0ea79ce5bea637f7bd7ebe94e698cd818a0.zip
event/TimeoutMonitor: eliminate support for periodic events
No caller needs this. Fixes use-after-free after returning from Client::OnTimeout().
Diffstat (limited to 'src/event/TimeoutMonitor.cxx')
-rw-r--r--src/event/TimeoutMonitor.cxx14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/event/TimeoutMonitor.cxx b/src/event/TimeoutMonitor.cxx
index e0bf997a0..8636292ac 100644
--- a/src/event/TimeoutMonitor.cxx
+++ b/src/event/TimeoutMonitor.cxx
@@ -45,21 +45,17 @@ TimeoutMonitor::ScheduleSeconds(unsigned s)
source = loop.AddTimeoutSeconds(s, Callback, this);
}
-bool
+void
TimeoutMonitor::Run()
{
- bool result = OnTimeout();
- if (!result && source != nullptr) {
- g_source_unref(source);
- source = nullptr;
- }
-
- return result;
+ Cancel();
+ OnTimeout();
}
gboolean
TimeoutMonitor::Callback(gpointer data)
{
TimeoutMonitor &monitor = *(TimeoutMonitor *)data;
- return monitor.Run();
+ monitor.Run();
+ return false;
}