[gtk+] Move mark check to gtk_text_view_scroll_to_mark()
- From: Kristian Rietveld <kristian src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+] Move mark check to gtk_text_view_scroll_to_mark()
- Date: Fri, 4 Sep 2009 15:41:27 +0000 (UTC)
commit dcc87f7a6786065b919516b7c806e3f33c5c10a3
Author: Kristian Rietveld <kris gtk org>
Date: Fri Sep 4 16:38:04 2009 +0200
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.
gtk/gtktextview.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 72d7fe3..ad9cba0 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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]