calling gtk_init more than once



Hello folks


This is my situation: I have a server (console), with a few threads to
handle the in/out data from the sockets; this server supports plugins, so I
was writing a GUI plugin for it, to set the server options localy without
needing a client connecting to it. So, at the plugin initialization I create
a new thread, and from there I call gtk_init and gtk_main.

My doubt: what if there's already another plugin (say, a "built-in" client,
or an "activity monitor", etc) using GTK+ running, that called
gtk_init/gtk_main (on another thread, obviously, not on the main thread of
the server)? Will it crash? Will gtk_init_check fail and return false (for
initializing it twice)? Can I do something like:

---
int initialized;
initialized = gtk_init_check(...);

gdk_threads_enter();

... build the GUI here ...

gdk_threads_leave();

if (!initialized)
        gtk_main();
---





Daniel K. O.







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