After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 532053 - Same wrapper name for multiple dynamic signals with the same name
Same wrapper name for multiple dynamic signals with the same name
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator
0.3.x
Other All
: Normal critical
: ---
Assigned To: Jürg Billeter
Vala maintainers
Depends on:
Blocks: 532290
 
 
Reported: 2008-05-07 21:12 UTC by rainwoodman
Modified: 2008-05-24 07:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
solving the problem. (1.48 KB, patch)
2008-05-07 21:13 UTC, rainwoodman
committed Details | Review
Updated patch. (2.25 KB, patch)
2008-05-11 20:05 UTC, rainwoodman
reviewed Details | Review

Description rainwoodman 2008-05-07 21:12:41 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.
Comment 1 rainwoodman 2008-05-07 21:13:47 UTC
Created attachment 110547 [details] [review]
solving the problem.
Comment 2 Jürg Billeter 2008-05-10 21:02:18 UTC
Confirming, thanks for the patch.
Comment 3 Jürg Billeter 2008-05-10 21:10:00 UTC
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.
Comment 4 rainwoodman 2008-05-11 20:05:38 UTC
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.
Comment 5 Jürg Billeter 2008-05-24 07:19:56 UTC
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.