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

Issue 108730044: tests/ibus-config Fix timeout_id handling (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years ago by fujiwara
Modified:
10 years ago
Reviewers:
teuf, shawn.p.huang, Peng
CC:
shawn.p.huang_gmail.com, fujiwara, cfergeau_redhat.com
Base URL:
git://github.com/ibus/ibus.git@master
Visibility:
Public.

Description

tests/ibus-config Fix timeout_id handling tests/ibus-config queues a timeout whose callback calls g_main_loop_quit() before returning FALSE. After exiting the mainloop, g_source_remove(timeout_id) is called, but if the mainloop was exited through the timeout callback, the source will already have been removed. This commit makes sure we only try to call g_source_remove() on that timeout if we did not exit the mainloop through the timeout callback. BUG=http://code.google.com/p/ibus/issues/detail?id=1712

Patch Set 1 #

Total comments: 5

Patch Set 2 : Updated with the latest master. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+10 lines, -5 lines) Patch
M src/tests/ibus-config.c View 1 4 chunks +10 lines, -5 lines 0 comments Download

Messages

Total messages: 4
fujiwara
10 years ago (2014-06-04 07:58:10 UTC) #1
Peng
https://codereview.appspot.com/108730044/diff/1/src/tests/ibus-config.c File src/tests/ibus-config.c (right): https://codereview.appspot.com/108730044/diff/1/src/tests/ibus-config.c#newcode138 src/tests/ibus-config.c:138: guint timeout_id; If the timeout_cb always returns false, and ...
10 years ago (2014-06-05 14:27:17 UTC) #2
teuf
https://codereview.appspot.com/108730044/diff/1/src/tests/ibus-config.c File src/tests/ibus-config.c (right): https://codereview.appspot.com/108730044/diff/1/src/tests/ibus-config.c#newcode298 src/tests/ibus-config.c:298: data->timeout_id = g_timeout_add (1, timeout_cb, data); On 2014/06/05 14:27:17, ...
10 years ago (2014-06-05 19:57:28 UTC) #3
Peng
10 years ago (2014-06-06 15:03:34 UTC) #4
lgtm

https://codereview.appspot.com/108730044/diff/1/src/tests/ibus-config.c
File src/tests/ibus-config.c (right):

https://codereview.appspot.com/108730044/diff/1/src/tests/ibus-config.c#newco...
src/tests/ibus-config.c:298: data->timeout_id = g_timeout_add (1, timeout_cb,
data);
On 2014/06/05 19:57:28, teuf wrote:
> On 2014/06/05 14:27:17, Peng wrote:
> > Can we use g_timeout_add(1, g_main_loop_quit, data->loop) here directly?
> 
> I think it's cleaner to remove it after the 1st g_main_loop_run() call,
> otherwise if the timeout did not trigger, the associated GSource will still
> exist, and then when we run the second g_main_loop_run() call, the timeout
which
> was setup for the 1st g_main_loop_run() call will still exist and could
trigger.

I see.
Sign in to reply to this message.

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