Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.2.0
-
None
-
Qt 5.2.1, Qt Visual Studio Addin 1.2.2 , Visual Studio 2010, Win7.
-
-
e2431b619da5c53d34df0b46105deb4450ed0c1f (qt/qtbase/5.14)
Description
I am developing an application using Qt Visual Studio Addin 1.2.2 on Visual Studio 2010. OS is Win7.
I got stuck with a problem. I described it here: http://stackoverflow.com/questions/25660089/qsqlquerymodel-with-a-parent-app-crash, but here's a sumup:
I have a searchDock : public QDockWidget class. It has a QSqlQueryModel* model field. I initialize the model in searchDock constructor:
model = new QSqlQueryModel(this);
Then - the model uses QSqlQuery query, that I prepare with a `QSqlQuery::prepare` method. I execute the query, and pass it to the model :
query.prepare(...); query.addBindValue(searchString); if (!query.exec()) { qDebug() << query.lastError(); return; } model->setQuery(query);
And then I pass he model to a TableView:
ui.kontrahenciList->setModel(model); ui.kontrahenciList->show();
It all works as far. The problem is, that when I close the application, I get an error:
Unhandled exception at 0x0f0c9f9a (qsqlpsqld.dll) in HurBudClientGUI.exe: 0xC0000005: Access violation reading location 0x00000004.
I do not delete anything manually anywhere .
Here's the call stack:
> qsqlpsqld.dll!QScopedPointer<QObjectData,QScopedPointerDeleter<QObjectData> >::data() Line 143 + 0x3 bytes C++
qsqlpsqld.dll!qGetPtrHelper<QScopedPointer<QObjectData,QScopedPointerDeleter<QObjectData> > >(const QScopedPointer<QObjectData,QScopedPointerDeleter<QObjectData> > & p) Line 919 + 0xb bytes C++
qsqlpsqld.dll!QPSQLDriver::d_func() Line 106 + 0x13 bytes C++
qsqlpsqld.dll!QPSQLResultPrivate::privDriver() Line 212 C++
qsqlpsqld.dll!QPSQLResultPrivate::deallocatePreparedStmt() Line 306 + 0xc bytes C++
qsqlpsqld.dll!QPSQLResult::~QPSQLResult() Line 328 C++
qsqlpsqld.dll!QPSQLResult::`scalar deleting destructor'() + 0xf bytes C++
Qt5Sqld.dll!QSqlQueryPrivate::~QSqlQueryPrivate() Line 94 + 0x23 bytes C++
Qt5Sqld.dll!QSqlQueryPrivate::`scalar deleting destructor'() + 0xf bytes C++
Qt5Sqld.dll!QSqlQuery::~QSqlQuery() Line 245 + 0x1e bytes C++
Qt5Sqld.dll!QSqlQueryModelPrivate::~QSqlQueryModelPrivate() Line 90 + 0x3d bytes C++
Qt5Sqld.dll!QSqlQueryModelPrivate::`scalar deleting destructor'() + 0xf bytes C++
Qt5Cored.dll!6703bf06()
[Frames below may be incorrect and/or missing, no symbols loaded for Qt5Cored.dll]
Qt5Cored.dll!6703b92a()
Qt5Cored.dll!670303f4()
Qt5Cored.dll!66f70dc4()
Qt5Cored.dll!66f73608()
Qt5Sqld.dll!QSqlQueryModel::~QSqlQueryModel() Line 175 + 0x9 bytes C++
HurBudClientGUI.exe!QSqlQueryModel::`scalar deleting destructor'() + 0x10 bytes C++
Qt5Cored.dll!67031929()
Qt5Widgetsd.dll!QWidget::~QWidget() Line 1488 C++
Qt5Widgetsd.dll!QDockWidget::~QDockWidget() Line 1172 + 0x22 bytes C++
HurBudClientGUI.exe!searchDock::~searchDock() Line 40 + 0x1c bytes C++
HurBudClientGUI.exe!HurBudClientGUI::~HurBudClientGUI() Line 35 + 0x12 bytes C++
HurBudClientGUI.exe!main(int argc, char * * argv) Line 23 + 0x1b bytes C++
HurBudClientGUI.exe!WinMain(HINSTANCE__ * instance, HINSTANCE__ * prevInstance, char * __formal, int cmdShow) Line 131 + 0x12 bytes C++
HurBudClientGUI.exe!__tmainCRTStartup() Line 547 + 0x2c bytes C
HurBudClientGUI.exe!WinMainCRTStartup() Line 371 C
kernel32.dll!75e9338a()
ntdll.dll!76f79f72()
ntdll.dll!76f79f45()
The problem doesn't occur when I use "plain" QSqlQuery (without prepared statement). The problem also occurs, when I initialize the model without a parent, but delete it in the searchDock desctructor.
I couldn't find any solution to this strange behaviour, so I think it's a bug
Attachments
Issue Links
- relates to
-
QTBUG-79019 QODBC - Crash when QSqlDatabase is removed when QSqlQuery is still active
- Closed