Got segv from ibus-serializable test. BTW, someone told me that "make check" always fails on ...
12 years, 3 months ago
(2012-07-30 07:52:53 UTC)
#1
Got segv from ibus-serializable test.
BTW, someone told me that "make check" always fails on the system where ibus is
not installed. Maybe good to make the tests not depend on the installed system?
https://codereview.appspot.com/6445057/diff/1/src/ibusserializable.c File src/ibusserializable.c (left): https://codereview.appspot.com/6445057/diff/1/src/ibusserializable.c#oldcode164 src/ibusserializable.c:164: g_variant_unref (value); I do not understand why this unref ...
12 years, 3 months ago
(2012-07-30 14:00:06 UTC)
#2
On 2012/07/30 07:52:53, Daiki Ueno wrote: > Got segv from ibus-serializable test. > > BTW, ...
12 years, 3 months ago
(2012-07-30 14:00:34 UTC)
#3
On 2012/07/30 07:52:53, Daiki Ueno wrote:
> Got segv from ibus-serializable test.
>
> BTW, someone told me that "make check" always fails on the system where ibus
is
> not installed. Maybe good to make the tests not depend on the installed
system?
That is good idea. patches are welcome.
https://codereview.appspot.com/6445057/diff/1/src/ibusserializable.c File src/ibusserializable.c (left): https://codereview.appspot.com/6445057/diff/1/src/ibusserializable.c#oldcode164 src/ibusserializable.c:164: g_variant_unref (value); On 2012/07/30 14:00:06, Peng wrote: > I ...
12 years, 3 months ago
(2012-07-31 01:13:39 UTC)
#4
https://codereview.appspot.com/6445057/diff/1/src/ibusserializable.c
File src/ibusserializable.c (left):
https://codereview.appspot.com/6445057/diff/1/src/ibusserializable.c#oldcode164
src/ibusserializable.c:164: g_variant_unref (value);
On 2012/07/30 14:00:06, Peng wrote:
> I do not understand why this unref is wrong. could you please explain it?
> thanks.
The second paragraph of the g_variant_iter_loop() API doc says:
"On the second and later calls, it is assumed that the same pointers will be
given and that they will point to the memory as set by the previous call to this
function. This allows the previous values to be freed, as appropriate."
Also in the example:
"/* no need to free 'key' and 'value' here */"
http://developer.gnome.org/glib/unstable/glib-GVariant.html#g-variant-iter-loop
So I read this as value will be unref'ed automatically in each iteration.
Actual error is as follows:
/ibus/attachment:
(/home/ueno/devel/ibus/src/tests/.libs/lt-ibus-serializable:2870): GLib-CRITICAL
**: g_variant_unref: assertion `value->ref_count > 0' failed
12 years, 3 months ago
(2012-07-31 14:04:31 UTC)
#5
lgtm
https://codereview.appspot.com/6445057/diff/1/src/ibusserializable.c
File src/ibusserializable.c (left):
https://codereview.appspot.com/6445057/diff/1/src/ibusserializable.c#oldcode164
src/ibusserializable.c:164: g_variant_unref (value);
On 2012/07/31 01:13:39, Daiki Ueno wrote:
> On 2012/07/30 14:00:06, Peng wrote:
> > I do not understand why this unref is wrong. could you please explain it?
> > thanks.
>
> The second paragraph of the g_variant_iter_loop() API doc says:
>
> "On the second and later calls, it is assumed that the same pointers will be
> given and that they will point to the memory as set by the previous call to
this
> function. This allows the previous values to be freed, as appropriate."
>
> Also in the example:
>
> "/* no need to free 'key' and 'value' here */"
>
>
http://developer.gnome.org/glib/unstable/glib-GVariant.html#g-variant-iter-loop
>
> So I read this as value will be unref'ed automatically in each iteration.
> Actual error is as follows:
>
> /ibus/attachment:
> (/home/ueno/devel/ibus/src/tests/.libs/lt-ibus-serializable:2870):
GLib-CRITICAL
> **: g_variant_unref: assertion `value->ref_count > 0' failed
Understand now. Thanks.
Issue 6445057: Fix double-unref when looping over attachment.
(Closed)
Created 12 years, 3 months ago by Daiki Ueno
Modified 12 years, 3 months ago
Reviewers: shawn.p.huang_gmail.com
Base URL: git@github.com:ibus/ibus.git@master
Comments: 3