TextView: Don't access already disposed text mark

Instead of asking of TextMark for its buffer,
let's reference also the buffer in the SelectionData.

Closes #169
This commit is contained in:
Marek Kasik 2018-04-17 15:54:24 +02:00
parent e23b65e434
commit 0abf8efd2f

View File

@ -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);
gtk_text_buffer_delete_mark (data->buffer, data->orig_start);
if (data->orig_end != NULL)
gtk_text_buffer_delete_mark (gtk_text_mark_get_buffer (data->orig_end),
data->orig_end);
gtk_text_buffer_delete_mark (data->buffer, data->orig_end);
g_object_unref (data->buffer);
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);
data->buffer = g_object_ref (buffer);
gtk_text_view_check_cursor_blink (text_view);
g_object_set_qdata_full (G_OBJECT (priv->drag_gesture),