[gtk+] listbox: short-circuit if no sort function is set
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] listbox: short-circuit if no sort function is set
- Date: Tue, 21 Jun 2016 02:00:03 +0000 (UTC)
commit 3724592efb87567691d47e6f02a7cfb2dc014a3d
Author: Christian Hergert <chergert redhat com>
Date: Mon Jun 20 15:17:00 2016 -0700
listbox: short-circuit if no sort function is set
do_sort will crash if sort_func is not defined. Instead of adding a check
there in the hot path, just check for sort_func before invalidating the
sort of the underlying GSequence.
gtk/gtklistbox.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index 91c08e3..17f1907 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -1280,6 +1280,9 @@ gtk_list_box_invalidate_sort (GtkListBox *box)
g_return_if_fail (GTK_IS_LIST_BOX (box));
+ if (priv->sort_func == NULL)
+ return;
+
g_sequence_sort (priv->children, (GCompareDataFunc)do_sort, box);
g_sequence_foreach (priv->children, gtk_list_box_css_node_foreach, &previous);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]