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.

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]