Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QGis 3.0.3 crash using QSqlTableModel #27013

Closed
qgib opened this issue Jun 12, 2018 · 1 comment
Closed

QGis 3.0.3 crash using QSqlTableModel #27013

qgib opened this issue Jun 12, 2018 · 1 comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption Plugins

Comments

@qgib
Copy link
Contributor

qgib commented Jun 12, 2018

Author Name: Alfredo GarciaWoods (Alfredo GarciaWoods)
Original Redmine Issue: 19184
Affected QGIS version: 3.0.3
Redmine category:python_plugins


I am developing a Qgis plugin and Qgis 3.0.3 Crashes sometimes.
I know the source of the problem is QSqlTableModel, I am thinking that perhaps, is a matter of time… when I leave the plugin without any action for some minutes, perhaps the database connection is closed or something like that, and then, when I try to show the tableView again, it internally calls the broken connection(it is a presumption).

Stack Trace

QSqlQuery::value :
QSqlQueryModel::data :
QSqlTableModel::data :
QSortFilterProxyModel::lessThan :
QSortFilterProxyModel::qt_static_metacall :
QSortFilterProxyModel::sortRole :
QSortFilterProxyModel::sort :
QTableView::sortByColumn :
PyCFunction_FastCallDict :
PyObject_GenericGetAttr :
PyEval_EvalFrameDefault :
PyInit_pydevd_frame_evaluator_win32_36_64 :
PyObject_GenericGetAttr :
PyEval_EvalFrameDefault :
PyInit_pydevd_frame_evaluator_win32_36_64 :
PyFunction_FastCallDict :
PyObject_CallFunctionObjArgs :
PyObject_Call :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
QMetaObject::activate :
QAction::activate :
QAbstractButton::click :
QAbstractButton::mouseReleaseEvent :
QToolButton::mouseReleaseEvent :
QWidget::event :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QApplicationPrivate::sendMouseEvent :
QSizePolicy::QSizePolicy :
QSizePolicy::QSizePolicy :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QGuiApplicationPrivate::processMouseEvent :
QWindowSystemInterface::sendWindowSystemEvents :
QEventDispatcherWin32::processEvents :
CallWindowProcW :
DispatchMessageW :
QEventDispatcherWin32::processEvents :
qt_plugin_query_metadata :
QEventLoop::exec :
QCoreApplication::exec :
main :
BaseThreadInitThunk :
RtlUserThreadStart :

QGIS Info
QGIS Version: 3.0.3-Girona
QGIS code revision: 8a899c8
Compiled against Qt: 5.9.2
Running against Qt: 5.9.2
Compiled against GDAL: 2.2.4
Running against GDAL: 2.2.4

System Info
CPU Type: x86_64
Kernel Type: winnt
Kernel Version: 10.0.17134

@qgib
Copy link
Contributor Author

qgib commented Jun 12, 2018

Author Name: Alfredo GarciaWoods (Alfredo GarciaWoods)


I finaly found that QGis crashed because I was using a:
QSqlDatabase->QSqlTableModel->QTableView schema

And the order to reinit this keeping the original QTableView, is very important.
The solution was to do it in order:
So that the model QTableView-> QSqlTableModel doesn’t try to access a populated model, and a closed databases

if self.db!=None:
self.model.revertAll()
self.model.clear()
self.db.close()


  • status_id was changed from Open to Closed

@qgib qgib closed this as completed Jun 12, 2018
@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Plugins Crash/Data Corruption labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption Plugins
Projects
None yet
Development

No branches or pull requests

1 participant