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 532290 - defining the handler before connecting to the dynamic signal compiles to wrong c code.
defining the handler before connecting to the dynamic signal compiles to wron...
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator
0.3.x
Other All
: Normal normal
: ---
Assigned To: Jürg Billeter
Vala maintainers
: 529695 (view as bug list)
Depends on: 532053
Blocks:
 
 
Reported: 2008-05-09 05:50 UTC by rainwoodman
Modified: 2008-05-24 09:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
wrapping dynamic wrappers has to work with the new patch for 532053 (4.10 KB, patch)
2008-05-11 20:48 UTC, rainwoodman
committed Details | Review

Description rainwoodman 2008-05-09 05:50:32 UTC
Please describe the problem:
Defining the handler before connecting to the dynamic signal compiles to wrong c code.


Steps to reproduce:
using GLib;

class App: Object {
   void handler(DBus.Object sender){
     message("huh, the handler is never invoked because of the wrong order of the parameters");
   }
   void run(){
      DBus.Connection conn;
      dynamic DBus.Object obj = conn.get_object("abc", "d", "IF");
      obj.someSignal += handler;
      obj.someSignal += handler2;
   }
   void handler2(DBus.Object sender){
     message("The handler2 is OK");
   }
}


Actual results:
static void app_handler (App* self, DBusGProxy* sender);
static void app_handler2 (DBusGProxy* sender, App* self);


Expected results:
static void app_handler (App* self, DBusGProxy* sender);
static void app_handler2 (App* self, DBusGProxy* sender);

and proper create 'signal_handler_wrapper' for dynamic signals based on the prototype of the handler functions(as a contrast, for static signals the wrapper are based on the definition of the signal).

Does this happen every time?
Yes

Other information:
Not sure how to start the patch. 

plan:
move the code in Vala.CCodeAssignmentBinding.generate_signal_handler_wrapper to
virtual Vala.Signal.generate_signal_handler_wrapper(Vala.Method m);
and implentment 
override Vala.DyanmicSignal.generate_signal_handler_wrapper(Vala.Method m);

Does it make sense?
Comment 1 Jürg Billeter 2008-05-11 11:32:35 UTC
Confirming.

generate_signal_handler_wrapper shouldn't be moved to Vala.Signal but moving it to Vala.CCodeSignalBinding would make sense, that class first needs to be created, though. Alternatively, just extend the existing generate_signal_handler_wrapper method to also handle dynamic signals.
Comment 2 rainwoodman 2008-05-11 20:48:21 UTC
Created attachment 110732 [details] [review]
wrapping dynamic wrappers has to work with the new patch for 532053

Yes, the alternative one is easier to do.
Comment 3 Jürg Billeter 2008-05-23 21:02:40 UTC
*** Bug 529695 has been marked as a duplicate of this bug. ***
Comment 4 Jürg Billeter 2008-05-24 09:43:22 UTC
2008-05-24  Jürg Billeter  <j@bitron.ch>

	* gobject/valaccodeassignmentbinding.vala:

	Use signal handler wrappers for dynamic signals,
	patch by Yu Feng, fixes bug 532290

Fixed in r1419.