Bug 48646

Summary: [accounts-glib] fallback logic to get account ID is a bit broken
Product: Telepathy Reporter: Simon McVittie <smcv>
Component: mission-controlAssignee: Vivek Dasmohapatra <vivek>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium CC: danilo.eu, vivek
Version: git masterKeywords: patch
Hardware: Other   
OS: All   
URL: http://cgit.collabora.com/git/user/vivek/telepathy-mission-control/log/?h=fd.o-48646
Whiteboard:
i915 platform: i915 features:

Description Simon McVittie 2012-04-13 05:49:43 UTC
By inspection of the source code, _ag_account_local_value and _ag_account_global_value appear to expect to be passed a GValue initialized to store a string (G_TYPE_STRING).

However, before reaching the code path that issues this message:

  DEBUG ("no " MC_IDENTITY_KEY " found, synthesising one:");

the GValue has been unset with g_value_unset() (true since commit b29f2a85), which returns it to an all-zeroes state, in which it needs to be re-initialized with g_value_init() to be used.

I believe one correct fix is to insert a call to

  g_value_init (&value, G_TYPE_STRING);

just after that debug message is emitted.

Another possibility would be to change this code added by b29f2a85:

@@ -885,6 +885,10 @@ _ag_accountid_to_mc_key (McdAccountManagerSso *sso,
       g_value_unset (&value);
       return uid;
     }
+  else
+    {
+      g_value_unset (&value);
+    }
 
   if (!create)
     return NULL;

into:

      g_value_unset (&value);
      return uid;
    }
  else if (!create)
    {
      g_value_unset (&value);
      return NULL;
    }
Comment 1 Vivek Dasmohapatra 2012-04-13 06:14:40 UTC
You're right. How does this look?
Comment 2 Simon McVittie 2012-04-13 06:32:29 UTC
Looks good to me, but note that I have only read the code, not run it :-)
Comment 3 Danilo Cesar Lemes de Paula 2012-04-13 10:12:50 UTC
The g_value_init fixes the problem. I would say ship it.
Comment 4 Vivek Dasmohapatra 2012-05-02 10:46:40 UTC
(In reply to comment #3)
> The g_value_init fixes the problem. I would say ship it.

Merged to master, not released yet.
Comment 5 Simon McVittie 2012-05-08 07:45:02 UTC
Will be fixed in 5.13.0 whenever that gets released, so I'm going to close this.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.