[maemo-developers] Gtk Dialog box causing application to crash
From: Jussi Kukkonen jku at o-hand.comDate: Thu Aug 7 10:39:57 EEST 2008
- Previous message: Gtk Dialog box causing application to crash
- Next message: Gtk Dialog box causing application to crash
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Arvind1 K wrote:
>
> Hi All,
>
> I'm facing a strange problem while using GTK+ Dialog box
> I've used two dialogs one in IF and other in ELSE
>
> if (some condition)
> {
> GtkWidget *dialog1 = gtk_message_dialog_new (main_window,
> GTK_DIALOG_DESTROY_WITH_PARENT,
> GTK_MESSAGE_QUESTION,
> GTK_BUTTONS_YES_NO,
> "Send file to server %s?",
> filename);
> result = gtk_dialog_run (GTK_DIALOG (dialog1));
> gtk_widget_destroy (dialog1);
> }
>
> else
> {
> GtkWidget *dialog2 = gtk_message_dialog_new (main_window,
> GTK_DIALOG_DESTROY_WITH_PARENT,
> GTK_MESSAGE_QUESTION,
> GTK_BUTTONS_YES_NO,
> "Download file %s?",
> filename);
> result = gtk_dialog_run (GTK_DIALOG (dialog2));
> gtk_widget_destroy (dialog2);
> }
>
>
> However if I use just a single dialog box at a time, everything works fine.
> I've used gdk_threads_enter() and gdk_threads_leave() whereever
> possible. these dialog boxes are created on 'select' event of CList so i
> cannot use gdk_threads_enter() and gdk_threads_leave().
>
> I need to have few more dialog boxes, but using only 2 is causing
> problems of application crash.
> Can anybody address this issue?
I didn't really get what the actual problem here is, but some advice
that might help:
* Unless you really, really know that you need to use threads, you
probably don't... using threads to get basic UI working is almost
certainly a bad idea.
* gtk_dialog_run() makes the dialog modal, so you can't use several
dialogs at once. You'll have to connect to the "respose" signal and
and show the widget yourself.
HTH,
Jussi
--
Jussi Kukkonen <jku at o-hand.com>
OpenedHand Ltd <http://o-hand.com>
- Previous message: Gtk Dialog box causing application to crash
- Next message: Gtk Dialog box causing application to crash
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
