[gnome-settings-daemon] rfkill: Add some checks that a previous task is not overwritten



commit 290790b62c36bcea3b3a9ae0eab278c7193624a1
Author: Philip Withnall <withnall endlessm com>
Date:   Thu Feb 9 13:18:07 2017 +0000

    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

 plugins/rfkill/rfkill-glib.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/plugins/rfkill/rfkill-glib.c b/plugins/rfkill/rfkill-glib.c
index a5e0593..30a2a93 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]