aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-01-03 21:43:37 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:14:44 +0100
commit45adc5054edeb4aed9de48e2f354f05e85e8d49f (patch)
tree0029d5e55e5fc033abc386879fccaa94ee26ea68
parentcb2612d0cee5d676564a14749a28021cf412354d (diff)
iface-modem-3gpp: fix registration state context creation
-rw-r--r--src/mm-iface-modem-3gpp.c14
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;
}