g_main_context_prepare(): main loop already active in another thread



Hi,

I red the gtk_threads html page. I put the pair gdk_threads_enter() / gdk_threads_leave() inside a function outside the gtk_main loop as showed below:

void signalhandler (int signum)
{
        int status;
        waitpid ( -1, &status, WNOHANG );
        gdk_threads_enter();
        if ( WIFEXITED(status) )
        {
                if ( WEXITSTATUS (status) )
                {
gtk_window_set_title ( GTK_WINDOW (MainWindow) , "Xarchiver " VERSION );
                        response = ShowGtkMessageDialog (GTK_WINDOW
(MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_QUESTION,GTK_BUTTONS_YES_NO,g_strdup_printf ("An error occurred while reading the archive.\nWould you like to view the shell output ?") );
                        if (response == GTK_RESPONSE_YES) ShowShellOutput();
                        return;
                }
        }
        gtk_window_set_title ( GTK_WINDOW (MainWindow) , path );
        SetButtonState (1,1,1,1,1,1,1,0,0);
        gdk_threads_leave();
        g_free (path);
}

The function sighandler is "registered" into the main.c:
int main (int argc, char *argv[])
{
  signal (SIGCHLD, signalhandler);
  gtk_set_locale ();
  gtk_init (&argc, &argv);
.....
}

When it happens that a child exits with an error status I got the message as in the subject. Where am I wrong ?
--
Colossus

Cpsed, a Linux OpenGL 3D scene editor
http://cpsed.sourceforge.net/




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