aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mm-iface-modem-time.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/mm-iface-modem-time.c b/src/mm-iface-modem-time.c
index fbc4a1ad..d1a0dfbd 100644
--- a/src/mm-iface-modem-time.c
+++ b/src/mm-iface-modem-time.c
@@ -281,6 +281,22 @@ network_timezone_state_changed (MMIfaceModemTime *self)
}
static void
+stop_network_timezone (MMIfaceModemTime *self)
+{
+ NetworkTimezoneContext *ctx;
+
+ ctx = (NetworkTimezoneContext *) g_object_get_qdata (G_OBJECT (self), network_timezone_context_quark);
+ if (ctx) {
+ /* Remove signal connection and then trigger context free */
+ if (ctx->state_changed_id) {
+ g_signal_handler_disconnect (self, ctx->state_changed_id);
+ ctx->state_changed_id = 0;
+ }
+ g_object_set_qdata (G_OBJECT (self), network_timezone_context_quark, NULL);
+ }
+}
+
+static void
start_network_timezone (MMIfaceModemTime *self)
{
NetworkTimezoneContext *ctx;
@@ -295,6 +311,9 @@ start_network_timezone (MMIfaceModemTime *self)
if (G_UNLIKELY (!network_timezone_context_quark))
network_timezone_context_quark = (g_quark_from_static_string (NETWORK_TIMEZONE_CONTEXT_TAG));
+ /* Cleanup context properly if it already exists, including the signal handler */
+ stop_network_timezone (self);
+
ctx = g_new0 (NetworkTimezoneContext, 1);
g_object_set_qdata_full (G_OBJECT (self),
network_timezone_context_quark,
@@ -315,22 +334,6 @@ start_network_timezone (MMIfaceModemTime *self)
start_network_timezone_poll (self);
}
-static void
-stop_network_timezone (MMIfaceModemTime *self)
-{
- NetworkTimezoneContext *ctx;
-
- ctx = (NetworkTimezoneContext *) g_object_get_qdata (G_OBJECT (self), network_timezone_context_quark);
- if (ctx) {
- /* Remove signal connection and then trigger context free */
- if (ctx->state_changed_id) {
- g_signal_handler_disconnect (self, ctx->state_changed_id);
- ctx->state_changed_id = 0;
- }
- g_object_set_qdata (G_OBJECT (self), network_timezone_context_quark, NULL);
- }
-}
-
/*****************************************************************************/
void