From 3b1dc603c5f7174904bc1c6c01566700f0bab894 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Wed, 23 Sep 2009 18:43:43 +0200 Subject: Don't rely on the widget allocation to be != 0. This should fix bug #595945. --- src/empathy-call-window.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/empathy-call-window.c') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index e7cbadc23..363d29441 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -887,8 +887,18 @@ static void contact_avatar_changed_cb (EmpathyContact *contact, GParamSpec *pspec, GtkWidget *avatar_widget) { - init_contact_avatar_with_size (contact, avatar_widget, - avatar_widget->allocation.height); + int size; + + size = avatar_widget->allocation.height; + + if (size == 0) + { + /* the widget is not allocated yet, set a default size */ + size = MIN (REMOTE_CONTACT_AVATAR_DEFAULT_HEIGHT, + REMOTE_CONTACT_AVATAR_DEFAULT_WIDTH); + } + + init_contact_avatar_with_size (contact, avatar_widget, size); } static void -- cgit v1.2.3