Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2854)

Issue 6445057: Fix double-unref when looping over attachment. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 8 months ago by Daiki Ueno
Modified:
11 years, 8 months ago
Reviewers:
shawn.p.huang
Base URL:
git@github.com:ibus/ibus.git@master
Visibility:
Public.

Description

Fix double-unref when looping over attachment. BUG=none

Patch Set 1 #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+0 lines, -1 line) Patch
M src/ibusserializable.c View 1 chunk +0 lines, -1 line 3 comments Download

Messages

Total messages: 5
Daiki Ueno
Got segv from ibus-serializable test. BTW, someone told me that "make check" always fails on ...
11 years, 8 months ago (2012-07-30 07:52:53 UTC) #1
Peng
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 ...
11 years, 8 months ago (2012-07-30 14:00:06 UTC) #2
Peng
On 2012/07/30 07:52:53, Daiki Ueno wrote: > Got segv from ibus-serializable test. > > BTW, ...
11 years, 8 months ago (2012-07-30 14:00:34 UTC) #3
Daiki Ueno
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 ...
11 years, 8 months ago (2012-07-31 01:13:39 UTC) #4
Peng
11 years, 8 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.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b