summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Rietveld <kris@gtk.org>2009-09-04 16:38:04 +0200
committerKristian Rietveld <kris@gtk.org>2009-09-04 17:08:29 +0200
commitdcc87f7a6786065b919516b7c806e3f33c5c10a3 (patch)
treea3722ca4804f5511a509eb06eeeaed41fa927720
parent4adcb39f86e972cad16f7758184248dcb34a382a (diff)
downloadgdk-pixbuf-dcc87f7a6786065b919516b7c806e3f33c5c10a3.tar.gz
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.
-rw-r--r--gtk/gtktextview.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 72d7fe3a1..ad9cba06f 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -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,