diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-iface-modem-3gpp.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c index e7c1de7d..b1a0bbf4 100644 --- a/src/mm-iface-modem-3gpp.c +++ b/src/mm-iface-modem-3gpp.c @@ -715,21 +715,23 @@ get_registration_state_context (MMIfaceModem3gpp *self) { RegistrationStateContext *ctx; - if (G_UNLIKELY (!registration_state_context_quark)) { + if (G_UNLIKELY (!registration_state_context_quark)) registration_state_context_quark = (g_quark_from_static_string ( REGISTRATION_STATE_CONTEXT_TAG)); + + ctx = g_object_get_qdata (G_OBJECT (self), registration_state_context_quark); + if (!ctx) { /* Create context and keep it as object data */ ctx = g_new0 (RegistrationStateContext, 1); + ctx->cs = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN; + ctx->ps = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN; + g_object_set_qdata_full ( G_OBJECT (self), registration_state_context_quark, ctx, (GDestroyNotify)g_free); - - ctx->cs = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN; - ctx->ps = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN; - } else - ctx = g_object_get_qdata (G_OBJECT (self), registration_state_context_quark); + } return ctx; } |