Bug 17282

Summary: uim-xim crash with XIM_CREATE_IC
Product: UIM Reporter: Akira TAGOH <akira>
Component: bridge: XIMAssignee: uim-bugs
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: testcase

Description Akira TAGOH 2008-08-24 21:19:13 UTC
Created attachment 18487 [details]
testcase

Some implementations of toolkits or applications supports reconnecting to the XIM server. when XCreateIC fails for some reasons, uim-xim will crashes when XCreateIC is called next time.

Backtrace log on gdb:
% gdb --args uim-xim --trace --trace-xim
GNU gdb Fedora (6.8-17.fc9)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...
(gdb) r
Starting program: /usr/bin/uim-xim --trace --trace-xim
UIM-XIM bridge. Now supporting multiple locales.
Using full-synchronous XIM event flow
Supported conversion engines:
  direct (*)
  anthy (ja)
XMODIFIERS=@im=uim registered, selecting anthy (ja) as default conversion engine
selection notify request for locale.
selection notify request for transport.
<-: XIM_CONNECT.
accept xim connection.
->: XIM_CONNECT_REPLY.
<-: XIM_OPEN.
->: XIM_OPEN_REPLY.
->: XIM_SET_EVENT_MASK.
<-: XIM_QUERY_EXTENSION.
->: XIM_QUERY_EXTENSION_REPLY.
<-: XIM_ENCODING_NEGOTIATION.
->: XIM_ENCODING_NEGOTIATION_REPLY.
<-: XIM_CREATE_IC.
imid=1, icid=1 ic created.
imid=1, icid=1 ic deleted.
->: XIM_ERROR.
<-: XIM_CREATE_IC.

Program received signal SIGSEGV, Segmentation fault.
Connection::xim_create_ic (this=<value optimized out>, p=0x2235a50)
    at ximtrans.cpp:667
667         im->create_ic(p);
Missing separate debuginfos, use: debuginfo-install anthy.x86_64
(gdb) p im
$1 = (class XimIM *) 0x0
(gdb) bt
#0  Connection::xim_create_ic (this=<value optimized out>, p=0x2235a50)
    at ximtrans.cpp:667
#1  0x000000000040e8cb in Connection::OnRecv (this=0x222a8b0)
    at ximtrans.cpp:273
#2  0x000000000040a6fd in XConnection::readProc (this=0x222a8b0,
    ev=<value optimized out>) at connection.cpp:187
#3  0x0000000000404887 in check_pending_xevent () at main.cpp:331
#4  0x0000000000404ae4 in main_loop () at main.cpp:170
#5  0x00000000004054dd in main (argc=<value optimized out>,
    argv=<value optimized out>) at main.cpp:649
(gdb)
Comment 1 Etsushi Kato 2008-08-25 22:29:25 UTC
Thanks for your detailed analysis.

It seems uim-xim destroys its IM when creating the IC fails.  I'll change the behavior as you suggested.


Index: ximim.cpp
===================================================================
--- ximim.cpp   (revision 5520)
+++ ximim.cpp   (working copy)
@@ -126,7 +126,6 @@
     if (!ic) {
        mConn->push_error_packet(mID, icid,
                                 ERR_Style, "invalid im style");
-       mConn->terminate();
        return;
     }
     std::pair<C16, XimIC *> n(ic->get_icid(), ic);
Comment 2 Akira TAGOH 2008-08-26 20:35:15 UTC
That patch works fine. thanks!
Comment 3 Etsushi Kato 2008-08-27 01:44:16 UTC
Fixed in trunk.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.