[gtk+/gtk-3-20] listbox: short-circuit if no sort function is set
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-20] listbox: short-circuit if no sort function is set
- Date: Thu, 4 Aug 2016 15:39:43 +0000 (UTC)
commit 74a8099261625398c1b6fa8d5f98d84530137d82
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 25be593..2c21c6d 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]