Re: Timer start registration breaks the gtk_main()



Chris,



-----Original Message-----
>From: Chris Vine <chris cvine freeserve co uk>
>Sent: Mar 26, 2011 2:05 PM
>To: ikorot earthlink net
>Cc: gtk-list gnome org
>Subject: Re: Timer start registration breaks the gtk_main()
>
>On Sat, 26 Mar 2011 11:38:27 -0700 (GMT-07:00)
>ikorot earthlink net wrote:
>> If I comment out the call to g_timer_add_seconds() it does not crash.
>> 
>> 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, ReadData() is a non-static class member function.  Illegal casts
>to avoid compilation failure has, as you can tell, not saved you here.

So in order to fix it, I need to use 'static' in front of 'void ReadData()'?

Thank you.

>
>Since you don't provide the implementation of any of the other calls
>you are making, it is possible (maybe likely) that there are a number of
>other errors in your code.
>
>Chris
>
>



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