Il giorno Sat, 26 Mar 2011 11:38:27 -0700 (GMT-07:00) ikorot@xxxxxxxxxxxxx ha scritto: > Hi, Robert, > > > -----Original Message----- > >From: Robert Pearce <rob@xxxxxxxxxxxxxxxxxxxx> > >Sent: Mar 26, 2011 2:19 AM > >To: gtk-list@xxxxxxxxx > >Cc: ikorot@xxxxxxxxxxxxx > >Subject: Re: Timer start registration breaks the gtk_main() > > > >Hi ikorot@xxxxxxxxxxxxx, > > > >On Sat, 26 Mar 2011 01:54:31 -0700 (GMT-07:00) you wrote: > >> Hi, ALL, > >> Is it possible for the timer to cause gtk_main() to crash? > >> > >It's possible for anything to become the point where your program > >crashes if you are sufficiently badly abusing it. Why do you pick on > >"the timer" as your suspect? > > 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? > Basically followed example from http://zetcode.com/tutorials/gtktutorial/gtkevents/. ReadData() is not a good old C function, but a C++ method, carrying around a pointer to the CFrame instance. You should make ReadData() static or use more advanced tecniques, such as libsigc++ [1]. Ciao. -- Nicola [1] http://libsigc.sourceforge.net/ > > > > >> How do I debug/fix it? > >> > > > >There are many answers to this, all outside the scope of this mailing > >list. How do you normally approach debugging? > > Just run the program under gdb and get the point of crash. > Check all the variables at runtime under gdb. > Then study the code and see what the problem is. > > Thank you. > > > > >Cheers, > >Rob > > _______________________________________________ > gtk-list mailing list > gtk-list@xxxxxxxxx > http://mail.gnome.org/mailman/listinfo/gtk-list _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list