GNOME Bugzilla – Bug 658555
Problem with _tmp*_ variables
Last modified: 2011-09-08 15:58:59 UTC
Here is a sample of generated code with Vala 0.12.1 (it's OK): static gboolean completion_provider_real_match (GtkSourceCompletionProvider* base, GtkSourceCompletionContext* context) { /* ... */ GtkTextIter _tmp0_ = {0}; GtkTextIter iter; GtkTextBuffer* _tmp1_ = NULL; GtkTextBuffer* _tmp2_; GtkTextBuffer* buf; /* ... */ iter = _tmp0_; gtk_source_completion_context_get_iter (context, &iter); _tmp1_ = gtk_text_iter_get_buffer (&iter); /* ... */ } And here is the same sample but generated with Vala 0.13.4: static gboolean completion_provider_real_match (GtkSourceCompletionProvider* base, GtkSourceCompletionContext* context) { /* ... */ GtkTextIter _tmp0_ = {0}; GtkTextIter iter; GtkSourceCompletionContext* _tmp1_; GtkTextIter _tmp2_; GtkTextBuffer* _tmp3_ = NULL; /* ... */ iter = _tmp0_; _tmp1_ = context; _tmp2_ = iter; gtk_source_completion_context_get_iter (_tmp1_, &_tmp2_); _tmp3_ = gtk_text_iter_get_buffer (&iter); /* ... */ } There is a segfault with this code. To get the iter, Vala 0.13 assign the value to _tmp2_, but there is no "iter = _tmp2_;" afterwards. So when the next line try to get the value of "iter", there is a problem. I didn't try to write a minimal Vala code where this bug happens, I hope that the above samples are sufficient.
Created attachment 196005 [details] [review] gtksourceview-2.0: Fix SourceCompletionContext.get_iter bindings Fixes bug 658555. As there's no minimal Vala code, can you please test the patch?
(In reply to comment #1) > As there's no minimal Vala code, can you please test the patch? Yes, it works! Thank you :)
commit 7e3de74d8f98840d9a4bfbd9eeee31bc6e0b0dd6 Author: Luca Bruno <lucabru@src.gnome.org> Date: Thu Sep 8 17:23:33 2011 +0200 gtksourceview-2.0: Fix SourceCompletionContext.get_iter bindings Fixes bug 658555. This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.