Bug 213796 - crashes when clicking during scim gtkimm preedit
crashes when clicking during scim gtkimm preedit
Product: Fedora
Classification: Fedora
Component: scim (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Peng Huang
: i18n
: 214943 (view as bug list)
Depends On: 217827
Blocks: 214128
  Show dependency treegraph
Reported: 2006-11-02 19:11 EST by Jens Petersen
Modified: 2007-11-30 17:11 EST (History)
4 users (show)

See Also:
Fixed In Version: scim-1.4.5-7.fc7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-01-18 07:49:22 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
gtk2.backtrace (2.72 KB, text/plain)
2006-11-22 00:23 EST, Jens Petersen
no flags Details
add hide preedit string in IMEngine reset method. (467 bytes, patch)
2006-11-22 04:41 EST, Peng Huang
no flags Details | Diff
Turn off snooper mode to avoid this bug. (709 bytes, patch)
2006-11-23 03:48 EST, Peng Huang
no flags Details | Diff
Appatch from james.su@gmail.com (418 bytes, patch)
2006-11-28 01:50 EST, Peng Huang
no flags Details | Diff
Screenshot of the gedit (76.03 KB, image/png)
2007-01-18 07:40 EST, Ramakrishna Reddy Yekulla
no flags Details

  None (edit)
Description Jens Petersen 2006-11-02 19:11:26 EST
+++ This bug was initially created as a clone of Bug #206120 +++

Description of problem:

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.activate scim-chewing, ctrl-SPACE
2.launch gedit and enter ji3+Enter+ji3 (我我)
3.double-click several times after the second word 我
Actual results:
application crashed, pls see attached screenshot and details

Expected results:

Additional info:

-- Additional comment from xwang@redhat.com on 2006-09-12 04:53 EST --
Created an attachment (id=136060)

-- Additional comment from xwang@redhat.com on 2006-09-12 04:54 EST --
Created an attachment (id=136061)

-- Additional comment from xwang@redhat.com on 2006-09-12 05:02 EST --
And in oowriter, keep clicking after pre-edit word would clear all characters
before this word

-- Additional comment from xwang@redhat.com on 2006-09-14 05:43 EST --
Created an attachment (id=136246)
gdb gedit info

-- Additional comment from cchance@redhat.com on 2006-09-14 20:14 EST --
Created an attachment (id=136316)
gdb backtrace when the Bug Buddy windows pops up.

-- Additional comment from mclasen@redhat.com on 2006-09-15 11:14 EST --
Xiaohong, can you reproduce the same gedit stacktrace after installing 
gtk2-debuginfo and gtksourceview-debuginfo, please ?

-- Additional comment from llch@redhat.com on 2006-09-28 01:44 EST --
Can you assist on Matthias' request please? install appropriate *-debuginfo for

Also do other scim IMEs crash in the same way?

-- Additional comment from xwang@redhat.com on 2006-10-11 04:19 EST --
After installed gtk2-debuginfo and gtksourceview-debuginfo, ran gdb and did same
steps to reproduce the bug, gedit didn't crash but got frozen.

Installed packages are...

And it seems that other scim IMEs couldn't crash in the same way.

-- Additional comment from xwang@redhat.com on 2006-10-11 04:20 EST --
Created an attachment (id=138224)
gdb gedit info

-- Additional comment from petersen@redhat.com on 2006-10-30 21:24 EST --
Problem happens with gtktextview and other scim IMEs in general, and does not seem
to be gedit or scim-chewing specific.  Also happens with both scim and scim-bridge
im modules.

-- Additional comment from petersen@redhat.com on 2006-11-01 21:02 EST --
(In reply to comment #12)
> does not seem to be [..] scim-chewing specific

Actually testing further on my own rhel5 testbox yesterday , I could only
reproduce this with scim-chewing.

-- Additional comment from petersen@redhat.com on 2006-11-02 03:10 EST --
After testing more with Caius, it seems there may be two issues: Caius has been
testing with the scim gtkimm whereas I am using the scim-bridge immodule.

With the scim gtkimm clicking does not always reset preedit, whereas it does with
the scim-bridge gtkimm.  Hence one sees preedit movement and sometimes crashing
with the scim gtkimm but not scim-bridge for other IMEs too.  However scim-chewing
crashes under both scim and scim-bridge gtkimms, so it seems to be an additional

So probably a separate bug should be opened for scim for the lack of reset on
Comment 1 Jens Petersen 2006-11-02 20:27:58 EST
Both multiple clicking with either scim-pinyin or scim-chewing preedit on a line in
a gtktextview can cause crashes.
Comment 2 Jens Petersen 2006-11-10 02:49:24 EST
*** Bug 214943 has been marked as a duplicate of this bug. ***
Comment 3 Jens Petersen 2006-11-21 20:24:33 EST
also happens with scim-anthy
Comment 4 Jens Petersen 2006-11-21 20:26:24 EST
and Chinese scim-tables
Comment 5 Jens Petersen 2006-11-21 22:52:15 EST
Reported in upstream tracker as
Comment 6 Jens Petersen 2006-11-22 00:23:25 EST
Created attachment 141874 [details]

Here is another backtrace using a gtktextview from gtk-demo.
Comment 7 Peng Huang 2006-11-22 04:41:19 EST
Created attachment 141887 [details]
add hide preedit string in IMEngine reset method.

When user clicks the gtktextview, it will reset immodule (scim-bridge), and it
will cause IMEngine reseted. But scim-chewing does not hide preedit_string when
IMEngine reset is called. I think it's the root reason.
Comment 8 Caius Chance 2006-11-22 18:37:30 EST
Bug #209575 has the same behavior which:

`GTK_IM_MODULE=scim-bridge gedit` which uses scim-bridge as IMMODULE.

It was also be called reset and crashes because chewing didn't follow the command.

After the fix which add focus_out() and focus_in() in reset function within
chewing, it works for scim-bridge.


However, when IME is started by:

`GTK_IM_MODULE=scim gedit` which uses scim built-in IMMODULE.

It still crashes though SCIM's reset function has called chewing's reset
function, but it just doesn't clear the preedit even same focus_in() and
focus_out() modifications are in chewing reset function.


Just my exp hope that helps. Please kindly point out if I got any info inaccurate.
Comment 9 Jens Petersen 2006-11-22 20:57:04 EST
Shawn, this problem is not specific to scim-chewing.
Comment 10 Jens Petersen 2006-11-22 21:04:53 EST
Just to clarify: there were two problems - one was scim-chewing not resetting
preedit (bug 206120) which affects both scim-bridge and the scim gtkimm.
It is already fixed in devel (rawhide).

This remaining bug is only related to the scim gtkimm and occurs for scim-anthy,
scim-hangul, scim-pinyin, scim-chewing, and scim-tables (and probably scim-m17n

However attachment 141887 [details] might be a more correct way of fixing the scim-chewing
crash?  Perhaps you could attach it to the other bug?
Comment 11 Peng Huang 2006-11-22 22:47:42 EST
im-scim has two modes to filter keys. One is snooper, another is overriding
gtkimcontext filter_keypress method. when im-scim uses snooper, gtktextview will
not get any key events, and then it will not reset imcontext when mouse clicked.
It will make gtktextview and scim in a wrong state. 
There are two ways to fix it.
1. turn off snooper. (I am not sure if it has some impact)
2. snooper mouse event, reset im when mouse clicked. (I am not sure if can
snooper mouse events).
Comment 12 Peng Huang 2006-11-23 03:48:34 EST
Created attachment 141979 [details]
Turn off snooper mode to avoid this bug.

The patch is for scim component. It will turn off snooper in im-scim, It can
avoid this bug.
Comment 13 Jens Petersen 2006-11-24 01:24:56 EST
I tried setting /FrontEnd/GtkIMModule/UseKeySnooper = false
but I still seem able to reproduce the crash.
Comment 14 Jens Petersen 2006-11-24 03:47:15 EST
It seems the config key does not work. :-(

But the patch to turn off the snooper does. :)
Comment 15 Peng Huang 2006-11-26 21:33:49 EST
fixed in scim-1_4_5-4_fc7
Comment 16 Peng Huang 2006-11-28 01:50:11 EST
Created attachment 142262 [details]
Appatch from james.su@gmail.com


On 11/28/06, Shawn Huang <phuang@redhat.com> wrote:
> > Yusuke TABATA wrote:
>> > > Jens Petersen wrote:
>> > >
>>> > >> It seems the key snooper of the scim gtk immodule can lead to crashes
>>> > >> during preedit when clicking in a gtk text buffer.  (See
>>> > >>

>>> > >> for more details.)
>>> > >>
>>> > >> Can someone remind me what the key snooper function is useful for?
>>> > >>
>> > > Use of key snooper is work around for this issue.
>> > >	  http://bugzilla.gnome.org/show_bug.cgi?id=111438
>> > > FYI: Latest uim uses other method to avoid it.
>> > >
>> > > Anyway, I wonder if the crash really caused by snooper.
>> > >
> > I found when snooper is enabled, gtktextview will not get any key
> > events. If user clicks mouse button,
> > gtktextview will not reset IMContext, because he think IMContext did not
> > receive any key events. Then
> > gtktextview will calculate and show text selection, but the preedit
> > string was not cleaned. It will cause chaos
> > in gtktextview, and then crash.
> > I think we should enable snooper for hot keys, but skip other keys in
> > snooper callback. Does It make sense?

This way can't fix the issue mentioned in

IMHO, gtktextview should be fixed to avoid such crash even if the
preedit string was not cleaned. And im context should be reset no
matter whether it received any key events or not, when clicking mouse.
Comment 17 Peng Huang 2006-11-28 01:57:50 EST
hi mclasen, 
Could you review this patch for gtk from James Su (attachment 142262 [details])? Thanks.
Comment 18 Peng Huang 2006-11-29 23:40:19 EST
file a bug on gnome bugzilla
Comment 19 Peng Huang 2006-11-30 00:51:29 EST
Turn off snooper can work now very well. I close it temporarily.

fixed in scim-1_4_5-4_fc7 .
Comment 20 Jens Petersen 2006-11-30 01:23:46 EST
Thanks - it may be better to clone a separate gtk2 bug for the gtktextview patch.
Comment 21 Ramakrishna Reddy Yekulla 2007-01-18 07:40:52 EST
Created attachment 145909 [details]
Screenshot of the gedit 

Version tested against ::
1. scim-1.4.5-7.fc7

Steps to reproduce ::
1. Activate scim-chewing
2. Launch gedit 
3. Input the following keysequence  ji3+Enter+ji3 (我我)
3. Double-click several times after the second word 我

Observation ::
Gedit didnt not crash, resolving it for this version scim-1.4.5-7.fc7,
attaching the screen shot.

Note You need to log in before you can comment on or make changes to this bug.