jkall / qgis-midvatten-plugin

Midvatten plugin for QGIS
23 stars 8 forks source link

RuntimeError: wrapped C/C++ object of type QComboBox has been deleted #332

Closed andrew-demerchant closed 3 years ago

andrew-demerchant commented 3 years ago

I'm seeing the following quite often (though not 100% of the time) when I create a new blank database. It does seem to create the database, though, but I'm unsure if it's a fully working one or not:

`An error has occurred while executing Python code:

RuntimeError: wrapped C/C++ object of type QComboBox has been deleted Traceback (most recent call last): File "C:/Users/andrew.demerchant/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\midvatten\midvatten.py", line 82, in self.actionNewDB.triggered.connect(lambda x: self.new_db()) File "C:\Users\andrew.demerchant\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\midvatten\tools\midvatten_utils.py", line 1492, in new_func result = func(*args, *kwargs) File "C:/Users/andrew.demerchant/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\midvatten\midvatten.py", line 751, in new_db self.midvsettingsdialog.LoadAndSelectLastSettings() File "C:\Users\andrew.demerchant\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\midvatten\tools\db_utils.py", line 390, in func_wrapper ret = func(args, **kwargs) File "C:\Users\andrew.demerchant\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\midvatten\midvsettingsdialog.py", line 233, in LoadAndSelectLastSettings self.database_settings.update_settings(self.ms.settingsdict['database']) File "C:\Users\andrew.demerchant\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\midvatten\midvsettingsdialog.py", line 618, in update_settings self.dbtype_combobox = dbtype File "C:\Users\andrew.demerchant\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\midvatten\midvsettingsdialog.py", line 556, in dbtype_combobox index = self._dbtype_combobox.findText(utils.returnunicode(value)) RuntimeError: wrapped C/C++ object of type QComboBox has been deleted

`

HenrikSpa commented 3 years ago

Thanks for reporting the bug!

I managed to reproduce it by opening Midvatten settings dialog (the dock widget with the DB tab), closing it again and then creating a database.

HenrikSpa commented 3 years ago

It should be fixed now in branch qgis3_henrik. The settings dialog didn't close properly (it was still referenced from midvatten after the user pressed the X) so some objects were alive while others, like the QComboBox, was destroyed.

There is no issue with the database itself. This error happened after database creation. Just make sure it's selected in the DB tab in Midvatten settings dialog like it should be.