Bug 24994

Summary: Connect example doesn't initialize WockyXmppNode
Product: Wocky Reporter: Cosimo Cecchi <cosimoc>
Component: GeneralAssignee: Will Thompson <will>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium Keywords: patch
Version: unspecified   
Hardware: Other   
OS: All   
URL: http://git.collabora.co.uk/?p=user/wjt/wocky.git;a=commitdiff;h=refs/heads/call-init-in-connect-example
Whiteboard:
i915 platform: i915 features:

Comment 1 Simon McVittie 2010-03-09 09:43:42 UTC
 200   if (strcmp (stanza->node->name, "features")
 201       || strcmp (wocky_xmpp_node_get_ns (stanza->node), WOCKY_XMPP_NS_STREAM))
 202     {
 203       printf ("Didn't receive features stanza\n");
 204       g_main_loop_quit (mainloop);
 205       return;
 206     }
 207 
 208   wocky_xmpp_node_init ();

Why is w_x_n_i only called after we've already interacted with stanza->node?

Shouldn't construction of any WockyXmppStanza implicitly initialize WockyXmppNode?

Or, if w_x_n_i is a mandatory initialization function like g_type_init (but: ugh), shouldn't it be called from main()?
Comment 2 Will Thompson 2010-11-20 03:33:07 UTC
examples/connect.c was ‘fixed’ ages ago in <http://git.collabora.co.uk/?p=wocky.git;a=commitdiff;h=d0977e8aed68ec2169534c35e396b6be0df4146c>, but the fix is obviously incorrect: it only initializes Wocky in one branch of the example program. Hence, running it in 'connector' mode works, but running it in 'raw' mode does not.

The attached trivial patch actually fixes this bug.
Comment 3 Will Thompson 2010-11-20 03:44:54 UTC
(changing the branch name; i have more trivia coming up.)
Comment 4 Will Thompson 2010-11-30 13:40:17 UTC
Sjoerd reviewed this IRL.

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.