[MM] [PATCH v2] iface-modem-3gpp: clear deferred registration state update when disabling



---
 src/mm-iface-modem-3gpp.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c
index fa8da1a..2430056 100644
--- a/src/mm-iface-modem-3gpp.c
+++ b/src/mm-iface-modem-3gpp.c
@@ -1325,6 +1325,18 @@ periodic_registration_check_enable (MMIfaceModem3gpp *self)
                              (GDestroyNotify)registration_check_context_free);
 }
 
+static void
+clear_deferred_registration_state_update (MMIfaceModem3gpp *self)
+{
+    RegistrationStateContext *ctx = get_registration_state_context (self);
+
+    ctx->deferred_new_state = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN;
+    if (ctx->deferred_update_id) {
+        g_source_remove (ctx->deferred_update_id);
+        ctx->deferred_update_id = 0;
+    }
+}
+
 /*****************************************************************************/
 
 typedef struct _DisablingContext DisablingContext;
@@ -1436,6 +1448,9 @@ interface_disabling_step (DisablingContext *ctx)
     }
 
     case DISABLING_STEP_CLEANUP_UNSOLICITED_REGISTRATION_EVENTS:
+        /* Prevent any deferred registration state update from happening after the modem is disabled */
+        clear_deferred_registration_state_update (ctx->self);
+
         if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_unsolicited_registration_events &&
             MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_unsolicited_registration_events_finish) {
             MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_unsolicited_registration_events (
-- 
1.8.1.3



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