diff options
author | Alexander Golubev <fatzer2@gmail.com> | 2024-03-19 06:32:17 +0300 |
---|---|---|
committer | TDE Gitea <gitea@mirror.git.trinitydesktop.org> | 2024-03-21 00:10:27 +0000 |
commit | e1bb179fdec82544a3de80a0d51c2700fa27c0f5 (patch) | |
tree | 07f82e67eb54c252b882fffac337626c73b212b3 /plugins/src/inputmethods/xim | |
parent | 7e24b2b61e8e7393e647a3be4376e76435b7d331 (diff) | |
download | tqt3-e1bb179fdec82544a3de80a0d51c2700fa27c0f5.tar.gz tqt3-e1bb179fdec82544a3de80a0d51c2700fa27c0f5.zip |
inputmethods/xim: fix incorrect fontset ref counting
- rename fontsetRefCount -> fontsetCacheRefCount
- move fontsetCacheRefCount to constructor as setHolderWidget() could be
called more than once
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
Diffstat (limited to 'plugins/src/inputmethods/xim')
-rw-r--r-- | plugins/src/inputmethods/xim/qximinputcontext_x11.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/plugins/src/inputmethods/xim/qximinputcontext_x11.cpp b/plugins/src/inputmethods/xim/qximinputcontext_x11.cpp index 20ca44244..e56df9d99 100644 --- a/plugins/src/inputmethods/xim/qximinputcontext_x11.cpp +++ b/plugins/src/inputmethods/xim/qximinputcontext_x11.cpp @@ -116,7 +116,7 @@ extern "C" { much as possible */ static XFontSet fontsetCache[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -static int fontsetRefCount = 0; +static int fontsetCacheRefCount = 0; static const char * const fontsetnames[] = { "-*-fixed-medium-r-*-*-16-*,-*-*-medium-r-*-*-16-*", @@ -345,6 +345,8 @@ TQXIMInputContext::TQXIMInputContext() TQXIMInputContext::init_xim(); #if !defined(TQT_NO_XIM) + fontsetCacheRefCount++; + if( ! ximContextList ) ximContextList = new TQPtrList<TQXIMInputContext>; ximContextList->append( this ); @@ -360,7 +362,6 @@ void TQXIMInputContext::setHolderWidget( TQWidget *widget ) TQInputContext::setHolderWidget( widget ); #if !defined(TQT_NO_XIM) - fontsetRefCount++; if (! qt_xim) { tqWarning("TQInputContext: no input method context available"); return; @@ -441,7 +442,7 @@ TQXIMInputContext::~TQXIMInputContext() if (ic) XDestroyIC((XIC) ic); - if ( --fontsetRefCount == 0 ) { + if ( --fontsetCacheRefCount == 0 ) { Display *dpy = TQPaintDevice::x11AppDisplay(); for ( int i = 0; i < 8; i++ ) { if ( fontsetCache[i] && fontsetCache[i] != (XFontSet)-1 ) { |