GNOME Bugzilla – Bug 532290
defining the handler before connecting to the dynamic signal compiles to wrong c code.
Last modified: 2008-05-24 09:43:22 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?
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.
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.
*** Bug 529695 has been marked as a duplicate of this bug. ***
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.