Message dialog wont close



I am developing a program that occasionally needs to display a message box
for the user.  The problem is that when I press the close button the window
does not go away.  If I click on the X in the top right hand corner I get an
error saying that the window is not responding.  

 

The return value from gtk_dialog_run is GTK_RESPONSE_CLOSE and my program
continues to run fine after closing the dialog.  

 

This code is run in its own thread and these are the only gtk calls that are
made in the entire program.   Do I need to have a gtk_main() in order for it
to work?

 

Here is the relevant code I am using

 

g_thread_init(0);

gdk_threads_init();

gdk_threads_enter();

            

initCheck = gtk_init_check(&argc, &cptr);

            

if(initCheck == FALSE)

{

            return;

}

            

window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

            

if(window == 0)

{

            return;

}

            

gtk_container_border_width (GTK_CONTAINER (window), 10);

 

dialog = gtk_message_dialog_new ((GtkWindow *)window,

 
GTK_DIALOG_DESTROY_WITH_PARENT,

                                                 GTK_MESSAGE_INFO,

                                                 GTK_BUTTONS_CLOSE,

                                                 message);

            

if(dialog == 0)

{

                        return;

}

            

gdk_threads_leave();

            

gint dialogResult = gtk_dialog_run (GTK_DIALOG (dialog));

            

gtk_widget_destroy (dialog);

gtk_widget_destroy (window);

 

return;

 

Is there something obvious I am missing that is needed to make the dialog
window go away?

 

Mathew B 

 

 

 

 




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