qsql_sqlite: fix segfault in dtor of orphan result
d79ae90466 accidentally removed the check
on the driver pointer before dereferencing it. This causes a segfault
when deleting a result object after its driver has already been deleted.
This situation can arise when a database is removed, explicitly or
probably also upon unloading the driver plugin, while related
results still exist. The problem affected
qttools/tests/auto/qhelpcontentmode.
Task-number: QTBUG-49836
Change-Id: I8ce8f8a5e27d787309ac2ff644b388e333d76435
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
bb10
parent
371c2e4786
commit
02a730331e
|
|
@ -351,7 +351,8 @@ QSQLiteResult::QSQLiteResult(const QSQLiteDriver* db)
|
|||
QSQLiteResult::~QSQLiteResult()
|
||||
{
|
||||
Q_D(QSQLiteResult);
|
||||
const_cast<QSQLiteDriverPrivate*>(d->drv_d_func())->results.removeOne(this);
|
||||
if (d->drv_d_func())
|
||||
const_cast<QSQLiteDriverPrivate*>(d->drv_d_func())->results.removeOne(this);
|
||||
d->cleanup();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue