[gtksourceview] CompletionInfo: the child can be NULL
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] CompletionInfo: the child can be NULL
- Date: Sat, 14 Sep 2013 15:33:14 +0000 (UTC)
commit 3453e85da141f76076558a72bb24e297eacc7f17
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Sep 14 17:30:00 2013 +0200
CompletionInfo: the child can be NULL
If there is no child, the CompletionInfo size is 0x0.
gtksourceview/gtksourcecompletioninfo.c | 33 +++++++++++++++++++++---------
1 files changed, 23 insertions(+), 10 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletioninfo.c b/gtksourceview/gtksourcecompletioninfo.c
index 53e2288..497dfc1 100644
--- a/gtksourceview/gtksourcecompletioninfo.c
+++ b/gtksourceview/gtksourcecompletioninfo.c
@@ -93,10 +93,13 @@ idle_resize (GtkSourceCompletionInfo *info)
gint cur_window_width;
gint cur_window_height;
- g_assert (child != NULL);
-
info->priv->idle_resize = 0;
+ if (child == NULL)
+ {
+ return G_SOURCE_REMOVE;
+ }
+
gtk_widget_get_preferred_size (child, NULL, &nat_size);
border_width = gtk_container_get_border_width (GTK_CONTAINER (info));
@@ -149,18 +152,23 @@ gtk_source_completion_info_get_preferred_width (GtkWidget *widget,
gint *nat_width)
{
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
- GtkRequisition nat_size;
+ gint width = 0;
- gtk_widget_get_preferred_size (child, NULL, &nat_size);
+ if (child != NULL)
+ {
+ GtkRequisition nat_size;
+ gtk_widget_get_preferred_size (child, NULL, &nat_size);
+ width = nat_size.width;
+ }
if (min_width != NULL)
{
- *min_width = nat_size.width;
+ *min_width = width;
}
if (nat_width != NULL)
{
- *nat_width = nat_size.width;
+ *nat_width = width;
}
}
@@ -170,18 +178,23 @@ gtk_source_completion_info_get_preferred_height (GtkWidget *widget,
gint *nat_height)
{
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
- GtkRequisition nat_size;
+ gint height = 0;
- gtk_widget_get_preferred_size (child, NULL, &nat_size);
+ if (child != NULL)
+ {
+ GtkRequisition nat_size;
+ gtk_widget_get_preferred_size (child, NULL, &nat_size);
+ height = nat_size.height;
+ }
if (min_height != NULL)
{
- *min_height = nat_size.height;
+ *min_height = height;
}
if (nat_height != NULL)
{
- *nat_height = nat_size.height;
+ *nat_height = height;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]