Re: Timer start registration breaks the gtk_main()
- From: ikorot earthlink net
- To: Robert Pearce <rob bdt-home demon co uk>
- Cc: gtk-list gnome org
- Subject: Re: Timer start registration breaks the gtk_main()
- Date: Sat, 26 Mar 2011 20:45:53 -0700 (GMT-07:00)
Robert,
-----Original Message-----
>From: Robert Pearce <rob bdt-home demon co uk>
>Sent: Mar 26, 2011 3:14 PM
>To: ikorot earthlink net
>Cc: gtk-list gnome org
>Subject: Re: Timer start registration breaks the gtk_main()
>
>Hi ikorot earthlink net,
>
>On Sat, 26 Mar 2011 11:38:27 -0700 (GMT-07:00) you wrote:
>> Hi, Robert,
>>
>> Here is what I do:
>>
>> int main()
>> {
>> CFrame *frame = new CFrame();
>> result = frame->OpenPort();
>> if( !result )
>> return 1;
>> else
>> {
>> g_timer_add_seconds( 1, (GSourceFunc) frame->ReadData(), NULL );
> ^^^^^^^^^ ^^
>> gtk_widget_show( window );
>> frame->ReadData();
>> gtk_main();
>> }
>> }
>>
>> in frame.h:
>>
>> class CFrame
>> {
>> void ReadData();
> ^^^^
>> }
>>
>> Do you see any problems with that?
>
>Yes. You are casting the _RESULT_ of a _CALL_ to ReadData into a GSourceFunc, but ReadData returns void. This produces utterly random results.
Yes, I believe I made a mistake here. I was not in front of my developmental machine,
so...
I think the ReadData() is returning gboolean.
Thank you.
>
>The second argument of g_timeout_add_seconds is a function pointer, and requires that you pass it a simple C function reference _without_ the call syntax.
>
>Cheers,
>Rob
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]