Re: Problem with gtk (done mistake)



On Mon, Dec 18, 2006 at 09:33:56AM +0530, Naveen Kumar wrote:
> #include <stdio.h>
> 
> int main ()
> {
> int i=0;
> while(i < 264000)
> printf("%d\n",i++);
> }
> 
> it works very fine in my machine without any problem. (it takes around
> 1.2 minutes)
> 
> 2)If try to run the same part of code on a button click using gtk,
> the application is crashing around 30 seconds saying just "Terminated".
> 
> Is there any time out as such we can specify for gtk applications..

There is nothing in Gtk+ that makes it automatically
terminate itself this way.  In stock Gtk+, that is.

However, there can be something in Montavista that
terminates non-responding GUI applications.  And your
program is definitely non-responding, because it spends all
time in the for loop, not giving Gtk+ main loop any chance
to react to events.

So you have to do

    while (gtk_events_pending())
        gtk_main_iteration();

occasionally or use other mechanism to let Gtk+ do its work.

Yeti


--
Whatever.



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