r41276 - in /desktop/unstable/gnome-calculator/debian: changelog patches/series patches/validate-iter.patch

ah at users.alioth.debian.org ah at users.alioth.debian.org
Sun Apr 6 15:53:35 UTC 2014


Author: ah
Date: Sun Apr  6 15:53:35 2014
New Revision: 41276

URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=41276
Log:
* Add debian/patches/validate-iter.patch (Closes: #742840)
  - this avoids crash when using comma as decimal separator.

Added:
    desktop/unstable/gnome-calculator/debian/patches/validate-iter.patch
Modified:
    desktop/unstable/gnome-calculator/debian/changelog
    desktop/unstable/gnome-calculator/debian/patches/series

Modified: desktop/unstable/gnome-calculator/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-calculator/debian/changelog?rev=41276&op=diff
==============================================================================
--- desktop/unstable/gnome-calculator/debian/changelog	[utf-8] (original)
+++ desktop/unstable/gnome-calculator/debian/changelog	[utf-8] Sun Apr  6 15:53:35 2014
@@ -1,3 +1,10 @@
+gnome-calculator (3.12.0-2) unstable; urgency=medium
+
+  * Add debian/patches/validate-iter.patch (Closes: #742840)
+    - this avoids crash when using comma as decimal separator.
+
+ -- Andreas Henriksson <andreas at fatal.se>  Sun, 30 Mar 2014 19:35:36 +0200
+
 gnome-calculator (3.12.0-1) unstable; urgency=medium
 
   [ Jackson Doak ]

Modified: desktop/unstable/gnome-calculator/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-calculator/debian/patches/series?rev=41276&op=diff
==============================================================================
--- desktop/unstable/gnome-calculator/debian/patches/series	[utf-8] (original)
+++ desktop/unstable/gnome-calculator/debian/patches/series	[utf-8] Sun Apr  6 15:53:35 2014
@@ -0,0 +1 @@
+validate-iter.patch

Added: desktop/unstable/gnome-calculator/debian/patches/validate-iter.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-calculator/debian/patches/validate-iter.patch?rev=41276&op=file
==============================================================================
--- desktop/unstable/gnome-calculator/debian/patches/validate-iter.patch	(added)
+++ desktop/unstable/gnome-calculator/debian/patches/validate-iter.patch	[utf-8] Sun Apr  6 15:53:35 2014
@@ -0,0 +1,62 @@
+commit a22b9074497ed9cca2fc7ab2c3a917027346cd97
+Author: Andreas Henriksson <andreas at fatal.se>
+Date:   Sun Apr 6 17:40:38 2014 +0200
+
+    validate returned iterator before passing to get_buffer
+    
+    This avoids crashing in get_buffer when get_iter returns empty iter.
+    Unfortunately get_iter doesn't return any indications if it
+    succeded (and filled the passed reference with useful information)
+    or failed (and didn't touch the references iter).
+    An improvement of the gtksourceview API might be useful here.
+    For now, work around this by knowing that vala will create an
+    empty iter used as reference to get_iter and then compare it
+    against another empty iter to know if get_iter succeded or failed.
+    
+    https://bugzilla.gnome.org/show_bug.cgi?id=727250
+    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=742840
+
+diff --git a/src/math-display.vala b/src/math-display.vala
+index f4da9b3..e5b347c 100644
+--- a/src/math-display.vala
++++ b/src/math-display.vala
+@@ -450,7 +450,18 @@ public class FunctionCompletionProvider : CompletionProvider
+ 
+     public override void populate (Gtk.SourceCompletionContext context)
+     {
+-        Gtk.TextBuffer text_buffer = context.get_iter ().get_buffer ();
++        Gtk.TextIter emptyiter = {};
++
++        var iter1 = context.get_iter ();
++        // This check is based on the assumption/knowledge
++        // that vala nulls the iter before passing at as a reference.
++        // The gtksourceview api has no way to signal error.
++        if (iter1 == emptyiter)
++        {
++            return;
++        }
++
++        Gtk.TextBuffer text_buffer = iter1.get_buffer ();
+         MathFunction[] functions = get_matches_for_completion_at_cursor (text_buffer);
+ 
+         List<Gtk.SourceCompletionItem>? proposals = null;
+@@ -501,7 +512,18 @@ public class VariableCompletionProvider : CompletionProvider
+ 
+     public override void populate (Gtk.SourceCompletionContext context)
+     {
+-        Gtk.TextBuffer text_buffer = context.get_iter ().get_buffer ();
++        Gtk.TextIter emptyiter = {};
++
++        var iter1 = context.get_iter ();
++        // This check is based on the assumption/knowledge
++        // that vala nulls the iter before passing at as a reference.
++        // The gtksourceview api has no way to signal error.
++        if (iter1 == emptyiter)
++        {
++            return;
++        }
++
++        Gtk.TextBuffer text_buffer = iter1.get_buffer ();
+         string[] variables = get_matches_for_completion_at_cursor (text_buffer, _equation.variables);
+ 
+         List<Gtk.SourceCompletionItem>? proposals = null;




More information about the pkg-gnome-commits mailing list