Codebase list gnome-calculator / debian/3.12.0-2
* Add debian/patches/validate-iter.patch (Closes: #742840) - this avoids crash when using comma as decimal separator. Andreas Henriksson 10 years ago
3 changed file(s) with 70 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 gnome-calculator (3.12.0-2) unstable; urgency=medium
1
2 * Add debian/patches/validate-iter.patch (Closes: #742840)
3 - this avoids crash when using comma as decimal separator.
4
5 -- Andreas Henriksson <andreas@fatal.se> Sun, 30 Mar 2014 19:35:36 +0200
6
07 gnome-calculator (3.12.0-1) unstable; urgency=medium
18
29 [ Jackson Doak ]
0 validate-iter.patch
0 commit a22b9074497ed9cca2fc7ab2c3a917027346cd97
1 Author: Andreas Henriksson <andreas@fatal.se>
2 Date: Sun Apr 6 17:40:38 2014 +0200
3
4 validate returned iterator before passing to get_buffer
5
6 This avoids crashing in get_buffer when get_iter returns empty iter.
7 Unfortunately get_iter doesn't return any indications if it
8 succeded (and filled the passed reference with useful information)
9 or failed (and didn't touch the references iter).
10 An improvement of the gtksourceview API might be useful here.
11 For now, work around this by knowing that vala will create an
12 empty iter used as reference to get_iter and then compare it
13 against another empty iter to know if get_iter succeded or failed.
14
15 https://bugzilla.gnome.org/show_bug.cgi?id=727250
16 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=742840
17
18 diff --git a/src/math-display.vala b/src/math-display.vala
19 index f4da9b3..e5b347c 100644
20 --- a/src/math-display.vala
21 +++ b/src/math-display.vala
22 @@ -450,7 +450,18 @@ public class FunctionCompletionProvider : CompletionProvider
23
24 public override void populate (Gtk.SourceCompletionContext context)
25 {
26 - Gtk.TextBuffer text_buffer = context.get_iter ().get_buffer ();
27 + Gtk.TextIter emptyiter = {};
28 +
29 + var iter1 = context.get_iter ();
30 + // This check is based on the assumption/knowledge
31 + // that vala nulls the iter before passing at as a reference.
32 + // The gtksourceview api has no way to signal error.
33 + if (iter1 == emptyiter)
34 + {
35 + return;
36 + }
37 +
38 + Gtk.TextBuffer text_buffer = iter1.get_buffer ();
39 MathFunction[] functions = get_matches_for_completion_at_cursor (text_buffer);
40
41 List<Gtk.SourceCompletionItem>? proposals = null;
42 @@ -501,7 +512,18 @@ public class VariableCompletionProvider : CompletionProvider
43
44 public override void populate (Gtk.SourceCompletionContext context)
45 {
46 - Gtk.TextBuffer text_buffer = context.get_iter ().get_buffer ();
47 + Gtk.TextIter emptyiter = {};
48 +
49 + var iter1 = context.get_iter ();
50 + // This check is based on the assumption/knowledge
51 + // that vala nulls the iter before passing at as a reference.
52 + // The gtksourceview api has no way to signal error.
53 + if (iter1 == emptyiter)
54 + {
55 + return;
56 + }
57 +
58 + Gtk.TextBuffer text_buffer = iter1.get_buffer ();
59 string[] variables = get_matches_for_completion_at_cursor (text_buffer, _equation.variables);
60
61 List<Gtk.SourceCompletionItem>? proposals = null;