GNOME Bugzilla – Bug 521688
Array of delegates doesn't work
Last modified: 2009-10-07 14:03:48 UTC
Please describe the problem: There is problem creating correct C code when using Callbacks in a "array" like this: public delegate void cbCommand(); public struct ServerCallbackData { public int replyID; public cbCommand cbc; ServerCallbackData( int id, cbCommand _cbc) { replyID=id; cbc = _cbc; } } public class ServerCommands : Object { ServerCallbackData[] commands; string parameter; construct { commands=new ServerCallbackData[] { new ServerCallbackData(1 , on_default), new ServerCallbackData(2, on_user) }; } .... C code failys to compile I will give an full example as attachment below Steps to reproduce: Actual results: test.c:33: error: request for member ‘cbc_target’ in something not a structure or union beloW: (*self).cbc = (_tmp0 = _cbc, self.cbc_target = _cbc_target, _tmp0); Expected results: should be: (*self).cbc = (_tmp0 = _cbc, (*self).cbc_target = _cbc_target, _tmp0); Does this happen every time? using NON static callbacks in arrays Other information: works when making class callback members static but imho it should work when nonstatic to :-)
Created attachment 107024 [details] full example code compile full example code compile with: valac --save-temps --pkg glib-2.0 test.vala -o testapp
Confirming, instance delegates in arrays are not supported at the moment.
*** Bug 523749 has been marked as a duplicate of this bug. ***
Thanks for your report. This problem has been fixed meanwhile and is working in Vala 0.7.7.