From fa966c6aa755e27c6d470402bf06e86cc5d2fdc8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 13 Aug 2004 04:00:29 +0000 Subject: [PATCH] Fix #149547, Markus Lausser: Thu Aug 12 23:52:12 2004 Matthias Clasen Fix #149547, Markus Lausser: * gtk/gtkcombobox.c (gtk_combo_box_size_allocate): * gtk/gtkcombobox.c (gtk_combo_box_size_request): Don't crash if size_request or size_allocate are called early. * gtk/gtkcombobox.c (gtk_combo_box_size_allocate): Protect against being allocated too small. --- ChangeLog | 14 +++++++++++++- ChangeLog.pre-2-10 | 14 +++++++++++++- ChangeLog.pre-2-6 | 14 +++++++++++++- ChangeLog.pre-2-8 | 14 +++++++++++++- gtk/gtkcombobox.c | 20 ++++++++++++++++++++ 5 files changed, 72 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 208bcd21df..e58f9d0865 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,18 @@ +Thu Aug 12 23:52:12 2004 Matthias Clasen + + Fix #149547, Markus Lausser: + + * gtk/gtkcombobox.c (gtk_combo_box_size_allocate): + * gtk/gtkcombobox.c (gtk_combo_box_size_request): Don't + crash if size_request or size_allocate are called early. + + * gtk/gtkcombobox.c (gtk_combo_box_size_allocate): Protect + against being allocated too small. + Thu Aug 12 21:02:57 2004 Matthias Clasen - * demos/gtk-demo/appwindow.c (about_cb): Adjust to GtkAboutDialog API changes. + * demos/gtk-demo/appwindow.c (about_cb): Adjust to GtkAboutDialog + API changes. * gtk/gtkaboutdialog.h: * gtk/gtkaboutdialog.c (gtk_about_dialog_set_email_hook): diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 208bcd21df..e58f9d0865 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,6 +1,18 @@ +Thu Aug 12 23:52:12 2004 Matthias Clasen + + Fix #149547, Markus Lausser: + + * gtk/gtkcombobox.c (gtk_combo_box_size_allocate): + * gtk/gtkcombobox.c (gtk_combo_box_size_request): Don't + crash if size_request or size_allocate are called early. + + * gtk/gtkcombobox.c (gtk_combo_box_size_allocate): Protect + against being allocated too small. + Thu Aug 12 21:02:57 2004 Matthias Clasen - * demos/gtk-demo/appwindow.c (about_cb): Adjust to GtkAboutDialog API changes. + * demos/gtk-demo/appwindow.c (about_cb): Adjust to GtkAboutDialog + API changes. * gtk/gtkaboutdialog.h: * gtk/gtkaboutdialog.c (gtk_about_dialog_set_email_hook): diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 208bcd21df..e58f9d0865 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,6 +1,18 @@ +Thu Aug 12 23:52:12 2004 Matthias Clasen + + Fix #149547, Markus Lausser: + + * gtk/gtkcombobox.c (gtk_combo_box_size_allocate): + * gtk/gtkcombobox.c (gtk_combo_box_size_request): Don't + crash if size_request or size_allocate are called early. + + * gtk/gtkcombobox.c (gtk_combo_box_size_allocate): Protect + against being allocated too small. + Thu Aug 12 21:02:57 2004 Matthias Clasen - * demos/gtk-demo/appwindow.c (about_cb): Adjust to GtkAboutDialog API changes. + * demos/gtk-demo/appwindow.c (about_cb): Adjust to GtkAboutDialog + API changes. * gtk/gtkaboutdialog.h: * gtk/gtkaboutdialog.c (gtk_about_dialog_set_email_hook): diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 208bcd21df..e58f9d0865 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,6 +1,18 @@ +Thu Aug 12 23:52:12 2004 Matthias Clasen + + Fix #149547, Markus Lausser: + + * gtk/gtkcombobox.c (gtk_combo_box_size_allocate): + * gtk/gtkcombobox.c (gtk_combo_box_size_request): Don't + crash if size_request or size_allocate are called early. + + * gtk/gtkcombobox.c (gtk_combo_box_size_allocate): Protect + against being allocated too small. + Thu Aug 12 21:02:57 2004 Matthias Clasen - * demos/gtk-demo/appwindow.c (about_cb): Adjust to GtkAboutDialog API changes. + * demos/gtk-demo/appwindow.c (about_cb): Adjust to GtkAboutDialog + API changes. * gtk/gtkaboutdialog.h: * gtk/gtkaboutdialog.c (gtk_about_dialog_set_email_hook): diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index a002a65427..62db8e26da 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -1629,6 +1629,8 @@ gtk_combo_box_size_request (GtkWidget *widget, GtkComboBox *combo_box = GTK_COMBO_BOX (widget); + gtk_combo_box_check_appearance (combo_box); + /* common */ gtk_widget_size_request (GTK_BIN (widget)->child, &bin_req); gtk_combo_box_remeasure (combo_box); @@ -1721,6 +1723,8 @@ gtk_combo_box_size_allocate (GtkWidget *widget, GtkRequisition req; gboolean is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL; + gtk_combo_box_check_appearance (combo_box); + widget->allocation = *allocation; gtk_widget_style_get (GTK_WIDGET (widget), @@ -1762,6 +1766,8 @@ gtk_combo_box_size_allocate (GtkWidget *widget, child.width = req.width; if (!is_rtl) child.x += width - req.width; + child.width = MAX (1, child.width); + child.height = MAX (1, child.height); gtk_widget_size_allocate (combo_box->priv->arrow, &child); if (is_rtl) child.x += req.width; @@ -1769,6 +1775,8 @@ gtk_combo_box_size_allocate (GtkWidget *widget, child.width = req.width; if (!is_rtl) child.x -= req.width; + child.width = MAX (1, child.width); + child.height = MAX (1, child.height); gtk_widget_size_allocate (combo_box->priv->separator, &child); if (is_rtl) @@ -1786,6 +1794,8 @@ gtk_combo_box_size_allocate (GtkWidget *widget, child.width -= child.x; } + child.width = MAX (1, child.width); + child.height = MAX (1, child.height); gtk_widget_size_allocate (GTK_BIN (widget)->child, &child); } else @@ -1798,6 +1808,8 @@ gtk_combo_box_size_allocate (GtkWidget *widget, child.y = allocation->y; child.width = req.width; child.height = allocation->height; + child.width = MAX (1, child.width); + child.height = MAX (1, child.height); gtk_widget_size_allocate (combo_box->priv->button, &child); if (is_rtl) @@ -1806,6 +1818,8 @@ gtk_combo_box_size_allocate (GtkWidget *widget, child.x = allocation->x; child.y = allocation->y; child.width = allocation->width - req.width; + child.width = MAX (1, child.width); + child.height = MAX (1, child.height); gtk_widget_size_allocate (GTK_BIN (widget)->child, &child); } } @@ -1822,6 +1836,8 @@ gtk_combo_box_size_allocate (GtkWidget *widget, child.y = allocation->y; child.width = req.width; child.height = allocation->height; + child.width = MAX (1, child.width); + child.height = MAX (1, child.height); gtk_widget_size_allocate (combo_box->priv->button, &child); /* frame */ @@ -1835,6 +1851,8 @@ gtk_combo_box_size_allocate (GtkWidget *widget, if (combo_box->priv->cell_view_frame) { + child.width = MAX (1, child.width); + child.height = MAX (1, child.height); gtk_widget_size_allocate (combo_box->priv->cell_view_frame, &child); /* the sample */ @@ -1855,6 +1873,8 @@ gtk_combo_box_size_allocate (GtkWidget *widget, } } + child.width = MAX (1, child.width); + child.height = MAX (1, child.height); gtk_widget_size_allocate (GTK_BIN (combo_box)->child, &child); } }