Re: Timer start registration breaks the gtk_main()



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/.

>
>> 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



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