summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2024-03-19 06:32:17 +0300
committerMichele Calgaro <michele.calgaro@yahoo.it>2024-03-21 09:11:45 +0900
commit41c8fa0f9dc70a101cc56f1b11737b8544295fee (patch)
tree2a9a664209812df628b703aa01696e0bb27b7458 /plugins
parentbb6797db1f6f36a38f528f39423cf7db47b3bd2f (diff)
downloadtqt3-41c8fa0f9dc70a101cc56f1b11737b8544295fee.tar.gz
tqt3-41c8fa0f9dc70a101cc56f1b11737b8544295fee.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> (cherry picked from commit e1bb179fdec82544a3de80a0d51c2700fa27c0f5)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/src/inputmethods/xim/qximinputcontext_x11.cpp7
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 ) {