[Glade-users] Gnome Glade 0.5.10 core dumping on Solaris with GnomeMessageBox



This is a multi-part message in MIME format.
--------------94069FFEC792518DFFBE737F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Graham Williams wrote:

I've just upgraded from 0.5.9 to 0.5.10 and my glade file is crashing
Glade.  I've narrowed it down to the inclusion of the following
GnomeMessageBox (in fact all of my GnomeMessageBoxes cause a crash,
but then they are all similar).  I haven't looked any further.

It's a bug which was added to gnome-libs on 30th May. It was fixed in
CVS gnome-libs on 14th July. I don't know which released versions of
gnome-libs it appears in. (It is in 1.2.3 which I'm using, and which I
think is still the last stable release.)

It only affects things like Glade & libglade which build the
GnomeMessageBox bit by bit.

Here's a patch which I hope works around it.

I'll probably put up 0.5.11 in a few days. I'll just see if any more
major problems turn up.

Thanks for the report (I'll let James know about the problem in libglade),

Damon
--------------94069FFEC792518DFFBE737F
Content-Type: text/plain; charset=us-ascii;
 name="patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="patch"

--- gnomemessagebox.c.orig      Sat May 20 16:24:21 2000
+++ gnomemessagebox.c   Tue Sep 26 15:05:14 2000
@@ -80,9 +80,6 @@
 };
 
 
-/* Copied from gnome-dialog.c to workaround initialization problems. */
-static void gnome_dialog_init_action_area (GnomeDialog * dialog);
-
 static void get_message_box_widgets (GtkWidget *dialog,
                                     GtkWidget **pixmap,
                                     GtkWidget **label);
@@ -123,11 +120,15 @@
     }
   else
     {
-      new_widget = gnome_message_box_new ("",  GNOME_MESSAGE_BOX_INFO, NULL);
+      /* FIXME: We create it with an OK button, and then remove the button,
+        to work around a bug in gnome_message_box_new() - it tries to set the
+        keyboard focus to the last button, which may not exist. It also
+        ensures that gnome_dialog_init_action_area() has been called. */
+      new_widget = gnome_message_box_new ("",  GNOME_MESSAGE_BOX_INFO,
+                                         GNOME_STOCK_BUTTON_OK, NULL);
 
-      /* FIXME: Kludge to initialize the action area so we can refer to it
-        below. */
-      gnome_dialog_init_action_area (GNOME_DIALOG (new_widget));
+      gtk_container_remove (GTK_CONTAINER (GNOME_DIALOG (new_widget)->action_area), GNOME_DIALOG 
(new_widget)->buttons->data);
+      GNOME_DIALOG (new_widget)->buttons = NULL;
     }
 
   gb_widget_create_from (GNOME_DIALOG (new_widget)->vbox,
@@ -153,35 +154,6 @@
 }
 
 
-/* FIXME: A kludge to initialize the action area, needed because
-   gnome_message_box_new() doesn't do this. Copied from gnome-dialog.c */
-static void
-gnome_dialog_init_action_area (GnomeDialog * dialog)
-{
-  GtkWidget * separator;
-
-  if (dialog->action_area)
-    return;
-
-  dialog->action_area = gtk_hbutton_box_new ();
-  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog->action_area),
-                            gnome_preferences_get_button_layout());
-
-  gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog->action_area), 
-                             GNOME_PAD);
-
-  gtk_box_pack_end (GTK_BOX (dialog->vbox), dialog->action_area, 
-                   FALSE, TRUE, 0);
-  gtk_widget_show (dialog->action_area);
-
-  separator = gtk_hseparator_new ();
-  gtk_box_pack_end (GTK_BOX (dialog->vbox), separator, 
-                     FALSE, TRUE,
-                     GNOME_PAD_SMALL);
-  gtk_widget_show (separator);
-}
-
-
 /*
  * Creates the components needed to edit the extra properties of this widget.
  */
@@ -392,11 +364,19 @@
   if (data->create_widget)
     {
       source_add (data,
+                 "  /* We create it with an OK button, and then remove the button, to work\n"
+                 "     around a bug in gnome-libs. */\n"
                  "  %s = gnome_message_box_new (%s,\n"
-                 "                              %s, NULL);\n",
+                 "                              %s,\n"
+                 "                              GNOME_STOCK_BUTTON_OK, NULL);\n",
                  data->wname,
                  source_make_string (label_text, data->use_gettext),
                  GbMessageBoxTypeSymbols[type_index]);
+
+      source_add (data,
+                 "  gtk_container_remove (GTK_CONTAINER (GNOME_DIALOG (%s)->action_area), GNOME_DIALOG 
(%s)->buttons->data);\n"
+                 "  GNOME_DIALOG (%s)->buttons = NULL;\n",
+                 data->wname, data->wname, data->wname);
     }
 
   gb_widget_write_standard_source (widget, data);

--------------94069FFEC792518DFFBE737F--








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