delete the private QLibrary data pointer if library is unloaded, swap it otherwise

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-06-12 17:30:59 +03:00
parent 46549a750b
commit d577fe9817

View file

@ -537,9 +537,16 @@ void QLibrary::setFileName(const QString &fileName)
if (qt_debug_component()) {
qDebug() << "QLibrary: reusing library" << librarymatch;
}
delete d_ptr;
d_ptr = loadedlibrary;
loadedlibraries->removeAt(i);
if (!d_ptr->pHnd) {
delete d_ptr;
d_ptr = loadedlibrary;
loadedlibraries->removeAt(i);
} else {
QLibraryPrivate* x_ptr = d_ptr;
d_ptr = loadedlibrary;
loadedlibraries->removeAt(i);
loadedlibraries->append(x_ptr);
}
return;
}
}