diff options
author | Alexander Golubev <fatzer2@gmail.com> | 2024-03-16 08:43:59 +0300 |
---|---|---|
committer | TDE Gitea <gitea@mirror.git.trinitydesktop.org> | 2024-03-16 10:31:27 +0000 |
commit | 1278ed0dad0a51d280d7b8b934a9280b459b107c (patch) | |
tree | 896bb05f14aa4d8d1b7dd7593f0f1501b1180585 /plugins | |
parent | 8e4edc5883e826848ca4903e5b73a7e2c0342024 (diff) | |
download | tqt3-1278ed0dad0a51d280d7b8b934a9280b459b107c.tar.gz tqt3-1278ed0dad0a51d280d7b8b934a9280b459b107c.zip |
Fix a small memory leak in xim plugin
TQXIMInputContext::setHolderWidget() function may be (and actually is)
called more than once. This results in multiple instances of the same
object being added to ximContextList. But the destructor removes only
one instance, which effectively results in leak of several bytes
whenever a window is opened.
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/src/inputmethods/xim/qximinputcontext_x11.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/src/inputmethods/xim/qximinputcontext_x11.cpp b/plugins/src/inputmethods/xim/qximinputcontext_x11.cpp index e9dbcdd29..20ca44244 100644 --- a/plugins/src/inputmethods/xim/qximinputcontext_x11.cpp +++ b/plugins/src/inputmethods/xim/qximinputcontext_x11.cpp @@ -343,6 +343,12 @@ TQXIMInputContext::TQXIMInputContext() { if(!isInitXIM) TQXIMInputContext::init_xim(); + +#if !defined(TQT_NO_XIM) + if( ! ximContextList ) + ximContextList = new TQPtrList<TQXIMInputContext>; + ximContextList->append( this ); +#endif // !TQT_NO_XIM } @@ -424,10 +430,6 @@ void TQXIMInputContext::setHolderWidget( TQWidget *widget ) // when resetting the input context, preserve the input state (void) XSetICValues((XIC) ic, XNResetState, XIMPreserveState, (char *) 0); - - if( ! ximContextList ) - ximContextList = new TQPtrList<TQXIMInputContext>; - ximContextList->append( this ); #endif // !TQT_NO_XIM } |