summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2017-02-09 13:18:07 +0000
committerBastien Nocera <hadess@hadess.net>2017-02-14 19:03:41 +0100
commit290790b62c36bcea3b3a9ae0eab278c7193624a1 (patch)
tree7466c5592aa5157c31ea878d2e3b529354f45a7b
parent75f23535e14969acbf74056a675ccd093987dc99 (diff)
downloadgnome-settings-daemon-290790b62c36bcea3b3a9ae0eab278c7193624a1.tar.gz
rfkill: Add some checks that a previous task is not overwritten
These should not fail, as write_change_all_timeout_cb() clears those variables — so they’re more for documentation than anything else. https://bugzilla.gnome.org/show_bug.cgi?id=778383
-rw-r--r--plugins/rfkill/rfkill-glib.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/plugins/rfkill/rfkill-glib.c b/plugins/rfkill/rfkill-glib.c
index a5e05934..30a2a93b 100644
--- a/plugins/rfkill/rfkill-glib.c
+++ b/plugins/rfkill/rfkill-glib.c
@@ -169,12 +169,18 @@ cc_rfkill_glib_send_change_all_event (CcRfkillGlib *rfkill,
task = g_task_new (rfkill, cancellable, callback, user_data);
g_task_set_source_tag (task, cc_rfkill_glib_send_change_all_event);
+ /* Clear any previous task. */
if (rfkill->change_all_timeout_id > 0) {
g_source_remove (rfkill->change_all_timeout_id);
rfkill->change_all_timeout_id = 0;
write_change_all_timeout_cb (rfkill);
}
+ g_assert (rfkill->event == NULL);
+ g_assert (rfkill->task == NULL);
+ g_assert (rfkill->cancellable == NULL);
+
+ /* Start writing out a new event. */
event = g_new0 (struct rfkill_event, 1);
event->op = RFKILL_OP_CHANGE_ALL;
event->type = rfkill_type;