[gtk+/gtk-3-0] widget: Do the sanity checks earlier
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-0] widget: Do the sanity checks earlier
- Date: Sat, 2 Apr 2011 01:59:05 +0000 (UTC)
commit 53ae5a1c09fb4fc8e8c81e6ebdd5cbb93bc39c3d
Author: Benjamin Otte <otte redhat com>
Date: Sat Apr 2 03:57:27 2011 +0200
widget: Do the sanity checks earlier
This avoids a crash in broken applications, in particular the gdm
greeter.
https://bugzilla.gnome.org/show_bug.cgi?id=646498
gtk/gtkwidget.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 3f99646..4c18fc1 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -4796,6 +4796,16 @@ gtk_widget_size_allocate (GtkWidget *widget,
old_allocation = priv->allocation;
real_allocation = *allocation;
+ if (real_allocation.width < 0 || real_allocation.height < 0)
+ {
+ g_warning ("gtk_widget_size_allocate(): attempt to allocate widget with width %d and height %d",
+ real_allocation.width,
+ real_allocation.height);
+ }
+
+ real_allocation.width = MAX (real_allocation.width, 1);
+ real_allocation.height = MAX (real_allocation.height, 1);
+
adjusted_allocation = real_allocation;
if (gtk_widget_get_request_mode (widget) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
{
@@ -4849,16 +4859,6 @@ gtk_widget_size_allocate (GtkWidget *widget,
real_allocation = adjusted_allocation;
}
- if (real_allocation.width < 0 || real_allocation.height < 0)
- {
- g_warning ("gtk_widget_size_allocate(): attempt to allocate widget with width %d and height %d",
- real_allocation.width,
- real_allocation.height);
- }
-
- real_allocation.width = MAX (real_allocation.width, 1);
- real_allocation.height = MAX (real_allocation.height, 1);
-
size_changed = (old_allocation.width != real_allocation.width ||
old_allocation.height != real_allocation.height);
position_changed = (old_allocation.x != real_allocation.x ||
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]