Branch: refs/heads/master
Home:   https://github.com/ibus/ibus

Commit: b5382549a2f4009e0e4da20c7491ba28e7cca60f
    https://github.com/ibus/ibus/commit/b5382549a2f4009e0e4da20c7491ba28e7cca60f
Author: Yusuke Sato <[email protected]>
Date:   2011-01-18 (Tue, 18 Jan 2011)

Changed paths:
  M bus/ibusimpl.c

Log Message:
-----------
Fix race condition between ibus_bus_set_global_engine() and 
ibus_bus_get_global_engine().

If focus moves between the two API calls, ibus_bus_get_global_engine() might 
return an unexpected engine name:

1. context A is focused, and the current global engine is "X".
2. ibus_bus_set_global_engine("Y") is called.
3. a user moves the focus from A to B. First, A's engine is set to NULL in 
bus_ibus_impl_set_focused_context(). Then, in the same function, B's engine is 
set to "X" (not "Y") since the _ibus_set_global_engine asynchronous call is not 
finished yet.
4. ibus_bus_set_global_engine("Y") async call successfully finishes. Context 
A's (not B's) engine is set to "Y", but context B, which has a focus, is not 
updated.
5. ibus_bus_get_global_engine() is called.

expected:
Y is returned.

actual:
X is returned. Since the context B has a focus, and B's engine is X.

BUG=http://crosbug.com/11031
TEST=see the bug

Review URL: http://codereview.appspot.com/4063041


-- 
You received this message because you are subscribed to the Google
Groups "ibus-devel" group.
iBus project web page: http://code.google.com/p/ibus/
iBus dev group: http://groups.google.com/group/ibus-devel?hl=en

回复