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>
(cherry picked from commit 1278ed0dad)
r14.1.x
Alexander Golubev 8 months ago committed by Michele Calgaro
parent d730db2c0d
commit 4bed6be862
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -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
}

Loading…
Cancel
Save