summaryrefslogtreecommitdiff
path: root/src/common/mainloop.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/mainloop.c')
-rw-r--r--src/common/mainloop.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/common/mainloop.c b/src/common/mainloop.c
index 5702c15..bf46cd8 100644
--- a/src/common/mainloop.c
+++ b/src/common/mainloop.c
@@ -1291,13 +1291,20 @@ static void super_work_cb(void *super_data, void *id, void *user_data)
ops->mod_defer(ml->super_data, ml->work, FALSE);
}
else {
- ops->del_io(ml->super_data, ml->iow);
- ops->del_timer(ml->super_data, ml->timer);
- ops->del_defer(ml->super_data, ml->work);
+ if (ml->iow != NULL) {
+ ops->del_io(ml->super_data, ml->iow);
+ ml->iow = NULL;
+ }
+
+ if (ml->work != NULL) {
+ ops->del_defer(ml->super_data, ml->work);
+ ml->work = NULL;
+ }
- ml->iow = NULL;
- ml->timer = NULL;
- ml->work = NULL;
+ if (ml->timer != NULL) {
+ ops->del_timer(ml->super_data, ml->timer);
+ ml->timer = NULL;
+ }
}
}