[Vala] invalid C code with signals



Hello list.

When trying to pass a signal as a function-pointer like
Thread.create(foo,...). it will actually emit the signal foo and use
its return value as parameter, and as g_signal_emit_by_name returns
void this results in a compile error.

I solved this by using a helper function to emit the signal and i
think it would be best if vala created such methods when you try
passing around signals as parameters, signals in vala are very similar
to functions in syntax and its its easy to presume they are going to
work the same way. Alternatively valac could just produce an error
saying that you cant use signals like that.

I'm attaching a sample class with this bug.

Attachment: SignalTest3.vala
Description: Binary data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]