Re: [gtk-list] Re: dialog communication, abusing gtk_main()?



Though it isn't an abuse of gtk_main, as someone
pointed out earlier (I lost the original email :( )
it does seem to bring up an unpleasant reentrance
issue:  basically, when you call something
like gnome_dialog_run_and_close it can cause
your handlers to reenter at that point [this is a call stack]:

	gtk_signal_emit(button1, "clicked");
	   your_dialog_creating_function
	      gnome_dialog_run_and_close
	        [in its main loop]
	        gtk_signal_emit(button1, "clicked");
	          your_dialog_creating_function

In other words, any function at all basically can
be called in the midst of your_dialog_creating_function.

This isn't too bad for trivial, non-OO applications,
but for class implementations and heavier applications
it gets hairier.  (In practice you don't call such functions
from within class implementations).

It boils down to:
	  some functions call functions which can reenter
	  anything.  so you have to know which functions
	  those are.

Has anyone figured out exact guidelines for
how to code in these conditions?

Am I missing some fundamental point?

- Dave

	  

On 22 Mar 2000, Havoc Pennington wrote:

> Swee Lim <lim_1@mail.com> writes: 
> > So my question is, does anyone know a better or more formal way of doing
> > this without abusing the gtk_main() function? thank you.
> > 
> 
> You aren't abusing gtk_main(), it is designed for this. The only thing
> you might want to consider is using g_main_run() and g_main_quit()
> instead, so you don't accidentally quit the wrong level of main loop.
> 
> Havoc
> 
> -- 
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
> 
> 



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