Skip to content

Commit ed03e99

Browse files
committedMay 30, 2017
catch uncatched exception when item has lost reference. fixies #15868
1 parent dcd99ad commit ed03e99

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
 

‎python/plugins/db_manager/layer_preview.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from qgis.PyQt.QtWidgets import QApplication
2626

2727
from qgis.gui import QgsMapCanvas, QgsMapCanvasLayer, QgsMessageBar
28-
from qgis.core import QgsVectorLayer, QgsMapLayerRegistry, QgsProject
28+
from qgis.core import QgsVectorLayer, QgsMapLayerRegistry, QgsProject, QgsMessageLog
2929

3030
from .db_plugins.plugin import Table
3131

@@ -78,11 +78,13 @@ def setDirty(self, val=True):
7878
def _clear(self):
7979
""" remove any layers from preview canvas """
8080
if self.item is not None:
81-
## skip exception on RuntimeError fixes #6892
8281
try:
8382
self.item.aboutToChange.disconnect(self.setDirty)
84-
except RuntimeError:
85-
pass
83+
## skip exception on RuntimeError fixes #6892
84+
## skip TypeError and generic Exceptions fixes #15868
85+
## generally due the remove of self.item object or C++ referenced object
86+
except Exception as ex:
87+
QgsMessageLog.logMessage(unicode(ex))
8688

8789
self.item = None
8890
self.dirty = False

0 commit comments

Comments
 (0)
Please sign in to comment.