Skip to content
Permalink
Browse files

catch uncatched exception when item has lost reference. fixies #15868

  • Loading branch information
luipir committed May 30, 2017
1 parent dcd99ad commit ed03e99ee582cb4abd1ae08cf333da8c0975a4c8
Showing with 6 additions and 4 deletions.
  1. +6 −4 python/plugins/db_manager/layer_preview.py
@@ -25,7 +25,7 @@
from qgis.PyQt.QtWidgets import QApplication

from qgis.gui import QgsMapCanvas, QgsMapCanvasLayer, QgsMessageBar
from qgis.core import QgsVectorLayer, QgsMapLayerRegistry, QgsProject
from qgis.core import QgsVectorLayer, QgsMapLayerRegistry, QgsProject, QgsMessageLog

from .db_plugins.plugin import Table

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

self.item = None
self.dirty = False

0 comments on commit ed03e99

Please sign in to comment.
You can’t perform that action at this time.