tst_qtranslator: fix memleak

QCoreApplication::installTranslator() does not take ownership of the
QTranslator. The QTranslator dtor removes itself from QCoreApplication
again.

Pick-to: 6.3 6.2 5.15
Change-Id: I17eb7ab350631eb32fe76af29d9a576a0efa05d8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
bb10
Marc Mutz 2021-12-21 14:06:39 +01:00
parent 7c8126d909
commit ab24390804
1 changed files with 3 additions and 3 deletions

View File

@ -408,9 +408,9 @@ void tst_QTranslator::translationInThreadWhileInstallingTranslator()
thread.runningCondition.wait(&thread.startupLock);
QTranslator *tor = new QTranslator;
QVERIFY(tor->load("hellotr_la"));
QCoreApplication::installTranslator(tor);
QTranslator tor;
QVERIFY(tor.load("hellotr_la"));
QVERIFY(QCoreApplication::installTranslator(&tor));
++thread.terminate;