Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uim on Qt5 #30

Closed
NgoHuy opened this issue Jul 5, 2013 · 11 comments
Closed

Uim on Qt5 #30

NgoHuy opened this issue Jul 5, 2013 · 11 comments

Comments

@NgoHuy
Copy link
Contributor

NgoHuy commented Jul 5, 2013

I built uim-1.8.5 on Qt5 successfully ( I merged code qt5 from master branch )

But when I typed on tea , it's segmentation fault . This bug seem to be libxcb error.

I debug

#0  0xb7227a58 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#1  0xb7fc42c3 in sendEvent (event=0xbfffed10, receiver=<optimized out>) at /usr/include/qt/QtCore/qcoreapplication.h:203

#2  QUimPlatformInputContext::commitString (this=this@entry=0x81441f8, str=...) at quimplatforminputcontext.cpp:601
#3  0xb7fc53ac in QUimPlatformInputContext::updatePreedit (this=this@entry=0x81441f8) at quimplatforminputcontext.cpp:637
#4  0xb7fc56ef in QUimPlatformInputContext::update_cb (ptr=0x81441f8) at quimplatforminputcontext.cpp:531
#5  0xb409b9b7 in im_update_preedit (uc_=0xb4049800) at uim-func.c:130
#6  0xb4077d4a in call (proc=<optimized out>, args=30, eval_state=eval_state@entry=0xbfffee94, need_eval=<optimized out>, 
    need_eval@entry=SCM_VALTYPE_NEED_EVAL) at ../sigscheme/src/eval.c:415
#7  0xb4078009 in scm_eval (obj=<optimized out>, env=<optimized out>, env@entry=135413328) at ../sigscheme/src/eval.c:499
#8  0xb40826fb in scm_s_letstar (bindings=30, body=3020254584, eval_state=0xbfffef74) at ../sigscheme/src/syntax.c:611
#9  0xb4077d1e in call (proc=<optimized out>, args=3020254584, eval_state=eval_state@entry=0xbfffef74, need_eval=<optimized out>, 
    need_eval@entry=SCM_VALTYPE_NEED_EVAL) at ../sigscheme/src/eval.c:420
#10 0xb4078009 in scm_eval (obj=<optimized out>, env=<optimized out>) at ../sigscheme/src/eval.c:499
#11 0xb40786c1 in scm_call (proc=<optimized out>, args=<optimized out>) at ../sigscheme/src/eval.c:94
#12 0xb7fbaa2c in GCROOTS_call_with_gc_ready_stack (ctx=0x8107658, proc=proc@entry=0xb4086c70 <uim_scm_callf_internal>, 
    arg=arg@entry=0xbffff02c) at gcroots.c:114
#13 0xb4085f5d in scm_call_with_gc_ready_stack (arg=0xbffff02c, arg@entry=0xbfffefec, 
    func=func@entry=0xb4086c70 <uim_scm_callf_internal>) at ../sigscheme/src/storage-gc.c:376
#14 uim_scm_call_with_gc_ready_stack (func=func@entry=0xb4086c70 <uim_scm_callf_internal>, arg=arg@entry=0xbffff02c)
    at uim-scm-sigscheme.c:458
#15 0xb4086eb5 in uim_scm_callf (proc=proc@entry=0xb40a0e22 "focus-out-handler", args_fmt=args_fmt@entry=0xb40a1bbc "p")
    at uim-scm-sigscheme.c:1010
#16 0xb4099c70 in uim_focus_out_context (uc=0x8ac95c0) at uim.c:320
#17 0xb7fc3970 in QUimPlatformInputContext::unsetFocus (this=0x81441f8) at quimplatforminputcontext.cpp:189
#18 0xb74d1c12 in QGuiApplicationPrivate::_q_updateFocusObject(QObject*) () from /usr/lib/libQt5Gui.so.5
#19 0xb74d1e19 in QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent*) ()
   from /usr/lib/libQt5Gui.so.5
#20 0xb74d1f60 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) ()
   from /usr/lib/libQt5Gui.so.5
#21 0xb74bc236 in QWindowSystemInterface::sendWindowSystemEventsImplementation(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at uim-scm-sigscheme.c:458
#15 0xb4086eb5 in uim_scm_callf (proc=proc@entry=0xb40a0e22 "focus-out-handler", args_fmt=args_fmt@entry=0xb40a1bbc "p")
    at uim-scm-sigscheme.c:1010
#16 0xb4099c70 in uim_focus_out_context (uc=0x8ac95c0) at uim.c:320
#17 0xb7fc3970 in QUimPlatformInputContext::unsetFocus (this=0x81441f8) at quimplatforminputcontext.cpp:189
#18 0xb74d1c12 in QGuiApplicationPrivate::_q_updateFocusObject(QObject*) () from /usr/lib/libQt5Gui.so.5
#19 0xb74d1e19 in QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent*) ()
   from /usr/lib/libQt5Gui.so.5
#20 0xb74d1f60 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) ()
   from /usr/lib/libQt5Gui.so.5
#21 0xb74bc236 in QWindowSystemInterface::sendWindowSystemEventsImplementation(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/libQt5Gui.so.5
#22 0xb74bc2bf in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Gui.so.5
#23 0xb4b63a81 in ?? () from /usr/lib/qt/plugins/platforms/libqxcb.so
#24 0xb6c7e10e in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
---Type <return> to continue, or q <return> to quit---
#25 0xb6c7e4b8 in ?? () from /usr/lib/libglib-2.0.so.0
#26 0xb6c7e578 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#27 0xb727224d in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#28 0xb4b63c86 in ?? () from /usr/lib/qt/plugins/platforms/libqxcb.so
#29 0xb72262f6 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#30 0xb7226704 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#31 0xb722bfc6 in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5
#32 0xb74c89a4 in QGuiApplication::exec() () from /usr/lib/libQt5Gui.so.5
#33 0xb7a23974 in QApplication::exec() () from /usr/lib/libQt5Widgets.so.5
#34 0x0805bd12 in ?? ()
#35 0xb6dba7c3 in __libc_start_main () from /usr/lib/libc.so.6
#36 0x0805c1f1 in ?? () 
@icy
Copy link
Contributor

icy commented Jul 5, 2013

@NgoHuy please let the team know what you did

@NgoHuy
Copy link
Contributor Author

NgoHuy commented Jul 6, 2013

I found that file qt5 / immodule / quimplatforminputcontext.cpp line 541 and 551
caused segmentation fault

ic->proxy->candidateActivate(nr, displayLimit);
ic->proxy->candidateSelect(index);

But I can not detect memory leak (ate a lot of my memory) when I use uim and tea (qt5 app)

@NgoHuy
Copy link
Contributor Author

NgoHuy commented Jul 7, 2013

I debugged and found that many uim-candwin-qt5 processes's running, it ate a lot of my ram

@mnogu
Copy link
Member

mnogu commented Jul 7, 2013

I debugged and found that many uim-candwin-qt5 processes's running, it ate a lot of my ram

The implementation of the Qt5 immodule is not finished and the Qt5 immodule is still buggy as you see.

@NgoHuy
Copy link
Contributor Author

NgoHuy commented Jul 7, 2013

My workaround temporarily disable uim-candwin-qt5, it works fine

void CandidateWindowProxy::initializeProcess()
{
    if (process->state() != QProcess::NotRunning) {
        //return;
        process->close();
    }
    process->close();

#if QT_VERSION < 0x050000
    process->start(UIM_LIBEXECDIR "/uim-candwin-qt4", QStringList() << style);
#else
    process->start(UIM_LIBEXECDIR "/uim-candwin-qt5", QStringList() << style);
#endif
    process->close();

@NaofumiHonda
Copy link
Contributor

NaofumiHonda commented Jun 5, 2016

I don't know the current status on this issue.
Anyway the attached patch makes uim work well with uim-candwin-qt5.
The reason of the issue is that: the uim-candwin-qt5 also load the uim-plugin,
and the loaded plugin again executes uim-candwin-qt5, which causes
infinite loops! So it suffices to block this recursive execution.

patch.zip

dai-vdr added a commit to dai-vdr/uim that referenced this issue Jun 6, 2016
@dai-vdr
Copy link
Contributor

dai-vdr commented Jun 6, 2016

@NaofumiHonda thank you for your patch!
I confirm it works well now. After more testing, I will merge this.

@dai-vdr
Copy link
Contributor

dai-vdr commented Jun 9, 2016

this fixes #72

@dai-vdr
Copy link
Contributor

dai-vdr commented Jun 10, 2016

Let's close this issue now. Please open new issue if you encounter some bug related Qt5.

@dai-vdr dai-vdr closed this as completed Jun 10, 2016
@NaofumiHonda
Copy link
Contributor

I found that the current commitment is based on an older version of my patch
where I replaced patch.zip one day later after the initial post.
So please apply the following additional patch also, otherwise not only uim-candwin-qt5 but also
all the programs invoked from a qt5 program (for example, a qt5 base terminal emulator)
are blocked to load the uim plugin.

addtional.zip

@dai-vdr
Copy link
Contributor

dai-vdr commented Jun 10, 2016

thank you, i applied it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants