Re: Timer start registration breaks the gtk_main()
- From: ikorot earthlink net
- To: Nicola Fontana <ntd entidi it>
- Cc: gtk-list gnome org
- Subject: Re: Timer start registration breaks the gtk_main()
- Date: Sat, 26 Mar 2011 20:23:16 -0700 (GMT-07:00)
Nicola,
-----Original Message-----
>From: Nicola Fontana <ntd entidi it>
>Sent: Mar 26, 2011 1:10 PM
>To: ikorot earthlink net
>Cc: Robert Pearce <rob bdt-home demon co uk>, gtk-list gnome org
>Subject: Re: Timer start registration breaks the gtk_main()
>
>Il giorno Sat, 26 Mar 2011 11:38:27 -0700 (GMT-07:00)
>ikorot earthlink net ha scritto:
>
>> Hi, Robert,
>>
>>
>> -----Original Message-----
>> >From: Robert Pearce <rob bdt-home demon co uk>
>> >Sent: Mar 26, 2011 2:19 AM
>> >To: gtk-list gnome org
>> >Cc: ikorot earthlink net
>> >Subject: Re: Timer start registration breaks the gtk_main()
>> >
>> >Hi ikorot earthlink net,
>> >
>> >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].
So all I need is to do:
class CFrame
{
static void ReadData();
}
?
Thank you.
>
>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 gnome org
>> http://mail.gnome.org/mailman/listinfo/gtk-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]