Move mark check to gtk_text_view_scroll_to_mark()
Also use a different means to check that the given mark is in the text view's buffer. This will also play nice with anonymous and NULL marks. Suggested by Paolo Borelli.
This commit is contained in:
parent
4adcb39f86
commit
dcc87f7a67
@ -1900,7 +1900,6 @@ gtk_text_view_queue_scroll (GtkTextView *text_view,
|
||||
gdouble xalign,
|
||||
gdouble yalign)
|
||||
{
|
||||
const char *mark_name;
|
||||
GtkTextIter iter;
|
||||
GtkTextPendingScroll *scroll;
|
||||
|
||||
@ -1913,12 +1912,6 @@ gtk_text_view_queue_scroll (GtkTextView *text_view,
|
||||
scroll->xalign = xalign;
|
||||
scroll->yalign = yalign;
|
||||
|
||||
/* We need to verify that the buffer contains the mark, otherwise this
|
||||
* can lead to data structure corruption later on.
|
||||
*/
|
||||
mark_name = gtk_text_mark_get_name (mark);
|
||||
g_return_if_fail (gtk_text_buffer_get_mark (get_buffer (text_view), mark_name));
|
||||
|
||||
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, mark);
|
||||
|
||||
scroll->mark = gtk_text_buffer_create_mark (get_buffer (text_view),
|
||||
@ -2167,6 +2160,11 @@ gtk_text_view_scroll_to_mark (GtkTextView *text_view,
|
||||
g_return_if_fail (xalign >= 0.0 && xalign <= 1.0);
|
||||
g_return_if_fail (yalign >= 0.0 && yalign <= 1.0);
|
||||
|
||||
/* We need to verify that the buffer contains the mark, otherwise this
|
||||
* can lead to data structure corruption later on.
|
||||
*/
|
||||
g_return_if_fail (get_buffer (text_view) == gtk_text_mark_get_buffer (mark));
|
||||
|
||||
gtk_text_view_queue_scroll (text_view, mark,
|
||||
within_margin,
|
||||
use_align,
|
||||
|
Loading…
Reference in New Issue
Block a user