[gtk/wip/baedert/for-master] text: Assert that we have ranges before using them
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master] text: Assert that we have ranges before using them
- Date: Mon, 18 May 2020 17:41:09 +0000 (UTC)
commit cca2228d4e420991643c1832b5a5d6a2b3bf2f85
Author: Timm Bäder <mail baedert org>
Date: Mon May 18 19:39:32 2020 +0200
text: Assert that we have ranges before using them
We never hit this code path otherwise but let's make sure.
gtk/gtktext.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 4dc3664a0c..d60e036208 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -2944,6 +2944,8 @@ gtk_text_drag_gesture_update (GtkGestureDrag *gesture,
text = _gtk_text_get_selected_text (self);
gtk_text_get_pixel_ranges (self, &ranges, &n_ranges);
+ g_assert (n_ranges > 0);
+
if (priv->editable)
actions = GDK_ACTION_COPY|GDK_ACTION_MOVE;
else
@@ -2968,7 +2970,7 @@ gtk_text_drag_gesture_update (GtkGestureDrag *gesture,
priv->drag = drag;
g_object_unref (drag);
-
+
g_free (ranges);
g_free (text);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]