Re: gtk+ lacks gtk_done()



Stefan Kost <kost imn htwk-leipzig de> writes:

> hi hi,
> 
> I've encountered a design problem in gtk+-1.2.X as well as in the gtk+-1.3.X series.
> It is the lack of gtk_done(). The problem arises from two facts :
> 1.) I use gtk+ from a plugin-library which gets loaded via dlopen
> 2.) gtk+- uses g_atexit()
> Now when I am done I dlclose the plugin-library. When I then end the application the
> gtk_exit_func() gets triggerd and crashes the application (illegal Instruction). In gtk+-1.2.X I was be able
> to install an exit handler myself before calling gtk_init and thus postpoing the
> dlclose() untill then. As my exit handler was adderd earlier it was called later
> und thus it worked.

Well, look at what gtk_exit_func() does:

static void
gtk_exit_func (void)
{
  if (gtk_initialized)
    {
      gtk_initialized = FALSE;
    }
}

So, there is an easier change:

Fri Feb  1 08:57:38 2002  Owen Taylor  <otaylor redhat com>

        * gtk/gtkmain.c (gtk_exit_func): Remove this useless
        atexit handler. (existance pointed out by Stefan Kost)

Still, note there is no way to free any of the resources that GTK+
allocates so I'm not really sure there is a big advantage to closing
your module and unloading GTK+, and there may be problems initializing
it again, even if you accept the memory and resource leak... it is
almost certainly better to just keep your module loaded permanently if
you can manage that.

Regards,
                                        Owen

[ You'll find other discussion on this topic in the archives; in
  2.2, we'll probably have the ability to uniniitalize the X parts
  of GTK+/GDK since that will follow along with multihead support, 
  but there are deeper issues with the type system that mean
  we'll be unlikely to have a gtk_uninit()  ]




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