[gtk+] Fix a segfault in gtk_statusbar_remove_all
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Fix a segfault in gtk_statusbar_remove_all
- Date: Mon, 31 Jan 2011 16:50:29 +0000 (UTC)
commit 30958ea8ad1a60449eb6ad47eb679a2de70d96ed
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Jan 31 11:32:19 2011 -0500
Fix a segfault in gtk_statusbar_remove_all
https://bugzilla.gnome.org/show_bug.cgi?id=640487
gtk/gtkstatusbar.c | 5 ++++-
gtk/tests/testing.c | 21 +++++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkstatusbar.c b/gtk/gtkstatusbar.c
index 6483f32..f3518c5 100644
--- a/gtk/gtkstatusbar.c
+++ b/gtk/gtkstatusbar.c
@@ -529,7 +529,10 @@ gtk_statusbar_remove_all (GtkStatusbar *statusbar,
if (prev == NULL)
prev = priv->messages;
- list = prev->next;
+ if (prev)
+ list = prev->next;
+ else
+ list = NULL;
}
else
{
diff --git a/gtk/tests/testing.c b/gtk/tests/testing.c
index bc002f6..07cd8d4 100644
--- a/gtk/tests/testing.c
+++ b/gtk/tests/testing.c
@@ -232,17 +232,38 @@ test_spin_button_arrows (void)
g_assert (oldval == 0);
}
+static void
+test_statusbar_remove_all (void)
+{
+ GtkWidget *statusbar;
+
+ g_test_bug ("640487");
+
+ statusbar = gtk_statusbar_new ();
+ g_object_ref_sink (statusbar);
+
+ gtk_statusbar_push (GTK_STATUSBAR (statusbar), 1, "bla");
+ gtk_statusbar_push (GTK_STATUSBAR (statusbar), 1, "bla");
+ gtk_statusbar_remove_all (GTK_STATUSBAR (statusbar), 1);
+
+ g_object_unref (statusbar);
+}
+
int
main (int argc,
char *argv[])
{
gtk_test_init (&argc, &argv);
+ g_test_bug_base ("http://bugzilla.gnome.org/");
gtk_test_register_all_types();
+
+ g_test_add_func ("/tests/statusbar-remove-all", test_statusbar_remove_all);
g_test_add_func ("/ui-tests/text-access", test_text_access);
g_test_add_func ("/ui-tests/button-clicks", test_button_clicks);
g_test_add_func ("/ui-tests/keys-events", test_button_keys);
g_test_add_func ("/ui-tests/slider-ranges", test_slider_ranges);
g_test_add_func ("/ui-tests/xserver-sync", test_xserver_sync);
g_test_add_func ("/ui-tests/spin-button-arrows", test_spin_button_arrows);
+
return g_test_run();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]