[gtk/169-gtktextview-accesses-already-disposed-object] TextView: Don't access already disposed text mark
- From: Marek Kašík <mkasik src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/169-gtktextview-accesses-already-disposed-object] TextView: Don't access already disposed text mark
- Date: Tue, 10 Apr 2018 12:58:48 +0000 (UTC)
commit a5d825c9232b145f76d33b3cb1016470600fa0bb
Author: Marek Kasik <mkasik redhat com>
Date: Tue Apr 10 14:57:25 2018 +0200
TextView: Don't access already disposed text mark
Instead of asking of TextMark for its buffer lets
weakly refer to the buffer in the SelectionData too.
Closes: #169
gtk/gtktextview.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index b0d53652be..36261ca52d 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -6987,17 +6987,20 @@ typedef struct
SelectionGranularity granularity;
GtkTextMark *orig_start;
GtkTextMark *orig_end;
+ GtkTextBuffer *buffer;
} SelectionData;
static void
selection_data_free (SelectionData *data)
{
- if (data->orig_start != NULL)
- gtk_text_buffer_delete_mark (gtk_text_mark_get_buffer (data->orig_start),
- data->orig_start);
- if (data->orig_end != NULL)
- gtk_text_buffer_delete_mark (gtk_text_mark_get_buffer (data->orig_end),
- data->orig_end);
+ if (data->buffer != NULL)
+ {
+ if (data->orig_start != NULL)
+ gtk_text_buffer_delete_mark (data->buffer, data->orig_start);
+
+ if (data->orig_end != NULL)
+ gtk_text_buffer_delete_mark (data->buffer, data->orig_end);
+ }
g_slice_free (SelectionData, data);
}
@@ -7277,6 +7280,7 @@ gtk_text_view_start_selection_drag (GtkTextView *text_view,
&orig_start, TRUE);
data->orig_end = gtk_text_buffer_create_mark (buffer, NULL,
&orig_end, TRUE);
+ g_set_weak_pointer (&data->buffer, buffer);
gtk_text_view_check_cursor_blink (text_view);
g_object_set_qdata_full (G_OBJECT (priv->drag_gesture),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]