GNOME Bugzilla – Bug 532053
Same wrapper name for multiple dynamic signals with the same name
Last modified: 2008-05-24 07:19:56 UTC
Please describe the problem: When multiple dynamic signals have the same name, the generated wrapper functions for different signals have the same name. Steps to reproduce: suppose A and B are dynamic DBus.Object objects and they have the same signal propChanged: A.propChanged += function1; B.propChanged += function2; the generated c code will be like: _dynamic_propChanged_connect (....) ... ... _dynamic_propChanged_connect (.....) which won't compile, because there are two functions with identical names. Actual results: Expected results: name them differently. Does this happen every time? Yes Other information: A dirty fix is to use a static variable in Vala.DynamicSignalBinding: private static signal_wrapper_id; and when get_connect_wrapper_name or get_disconnect_wrapper_name is invoked for the first time, inc signal_wrapper_id; because the function name is then cached by the binding object, we get consistent results. A patch follows.
Created attachment 110547 [details] [review] solving the problem.
Confirming, thanks for the patch.
2008-05-10 Jürg Billeter <j@bitron.ch> * gobject/valaccodedynamicsignalbinding.vala: Fix connecting to the same dynamic signal multiple times, patch by Yu Feng, fixes bug 532053 Fixed in r1355.
Created attachment 110729 [details] [review] Updated patch. In this patch I introduced a new method in Vala.DynamicSignal, DynamicSignal.get_dynamic_wrapper_cprefix This new method will be used in the fix for Bug 532290 , to obtain a proper name for the wrapper of the dynamic wrapper.
2008-05-24 Jürg Billeter <j@bitron.ch> * gobject/valaccodedynamicsignalbinding.vala: Add get_dynamic_cname method to CCodeDynamicSignalBinding class, based on patch by Yu Feng Fixed in r1418.