Bug 15853

Summary: uim-pref-qt doesn't work when libquiminputcontextplugin.so is installed
Product: UIM Reporter: UTUMI Hirosi <utuhiro78>
Component: helper: prefAssignee: uim-bugs
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Patch to count libuim's initialization
init wrapper patch
Revised patch

Description UTUMI Hirosi 2008-05-07 05:27:12 UTC
$ rm -rf ~/.uim.d/
$ uim-toolbar-qt

Press the "Preference" button on toolbar.
It causes some errors.
//
Error: in scm_symbol_value: unbound variable: custom-group-label
libuim: [fatal] an unhandled error raised from Scheme interpreter
libuim: All functionality has been disabled to save user application data.
libuim: [fatal] an unhandled error raised from Scheme interpreter
libuim: [fatal] All functionality has been disabled to save user application data.
//

Does it work for you?
(uim-toolbar-gtk works fine.)

uim version: 1.5.0
uim build options:
   --with-m17nlib \
   --without-canna \
   --without-prime \
   --without-scim \
   --without-eb \
   --with-qt4-immodule \
   --with-qt-immodule \
   --with-qt \
   --enable-dict \
   --disable-warnings-into-error
Comment 1 Etsushi Kato 2008-05-07 22:46:36 UTC
For some reason, Qt3 plugin instance for input methods is created (and destroyed) twice, and this seems to cause a problem for uim-pref-qt when libquiminputcontextplugin.so is installed.

One way to avoid such conditions is to count initialization of libuim (see attached patch).  Or just remove uim_quit() in UimInputContextPlugin::uimQuit() as a workaround.
Comment 2 Etsushi Kato 2008-05-07 22:48:37 UTC
Created attachment 16424 [details]
Patch to count libuim's initialization
Comment 3 UTUMI Hirosi 2008-05-08 04:04:45 UTC
uim-pref-qt works fine now.
Thank you so much.

I think this bug is critical.
Someone might want uim-1.5.1.
Comment 4 YamaKen 2008-05-08 05:44:32 UTC
Thank you for the report and the patch.

But IMHO, uim_init() and uim_quit() is not the place to be added the workaround, at least in 1.5 branch since it alters the API specification of the functions. Please resolve the problem in bridge layer.

See [Anthy-dev 1563] and following messages for further consideration. We had discussed such behavior once, and reverted to the current specification.
Comment 5 Etsushi Kato 2008-05-08 06:30:03 UTC
(In reply to comment #4) 
> But IMHO, uim_init() and uim_quit() is not the place to be added the
> workaround, at least in 1.5 branch since it alters the API specification of the
> functions. Please resolve the problem in bridge layer.
> 
> See [Anthy-dev 1563] and following messages for further consideration. We had
> discussed such behavior once, and reverted to the current specification.

Hehe, you already considered and tried this init count three years ago, which I don't remember well ;)

Do you think just removing uim_quit() in UimInputContextPlugin::uimQuit() is OK for now?  (Personally, I don't prefer this workaround because it must be a bug in immodule patch for Qt3).
Comment 6 YamaKen 2008-05-09 21:46:39 UTC
> Do you think just removing uim_quit() in UimInputContextPlugin::uimQuit() is OK
> for now?  (Personally, I don't prefer this workaround because it must be a bug
> in immodule patch for Qt3).
Though I don't know sufficient information about the Qt plugin management on immodule arena, the init count workaround is better than just removing uim_quit() since it is more proper and can behave as expected by Qt on any situations we don't know. I don't prefer introducing future possibility of another problem by removing uim_quit().

What about writing a wrapper functions for uim_init() and uim_quit() contaning the your init count workaround in the bridges and replace the uim_init/quit call with them?
Comment 7 Etsushi Kato 2008-05-11 19:30:54 UTC
Created attachment 16476 [details] [review]
init wrapper patch
Comment 8 Etsushi Kato 2008-05-11 19:33:12 UTC
(In reply to comment #6)

> What about writing a wrapper functions for uim_init() and uim_quit() contaning
> the your init count workaround in the bridges and replace the uim_init/quit
> call with them?

That should be fine.  I'll commit the above new patch if there is no further discussion. 

Comment 9 Etsushi Kato 2008-05-12 02:49:07 UTC
(In reply to comment #8)
> That should be fine.  I'll commit the above new patch if there is no further
> discussion. 


I noticed that the using convenience library cannot share a variable among plugins (uim_panelapplet.so and libquiminputcontextplugin.so in this case).  So I'll commit the patch except for kde applet part.  In addition, I'm going to remove unused reloadUim() in immodule.
Comment 10 Etsushi Kato 2008-05-12 02:50:01 UTC
Created attachment 16479 [details] [review]
Revised patch
Comment 11 YamaKen 2008-05-12 05:09:47 UTC
What about these names?

uim_counted_init()
uim_counted_quit()
uim_force_quit_regardless_of_count()

The 3rd name is bit too long, but I think it'll be used rare and so such descriptive name is preferable/acceptable.
Comment 12 Etsushi Kato 2008-05-12 08:27:29 UTC
(In reply to comment #11)
> What about these names?
> 
> uim_counted_init()
> uim_counted_quit()
> uim_force_quit_regardless_of_count()

OK.  I've committed this with putting the convenience library into uim/.

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.