[QGIS Commit] r13773 - trunk/qgis/python

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Jun 21 18:26:36 EDT 2010


Author: wonder
Date: 2010-06-21 22:26:36 +0000 (Mon, 21 Jun 2010)
New Revision: 13773

Modified:
   trunk/qgis/python/utils.py
Log:
Better cleanup of resources when unloading plugins


Modified: trunk/qgis/python/utils.py
===================================================================
--- trunk/qgis/python/utils.py	2010-06-21 22:09:30 UTC (rev 13772)
+++ trunk/qgis/python/utils.py	2010-06-21 22:26:36 UTC (rev 13773)
@@ -216,11 +216,11 @@
     # if it looks like a Qt resource file, try to do a cleanup
     # otherwise we might experience a segfault next time the plugin is loaded
     # because Qt will try to access invalid plugin resource data
-    if "resources" in mod:
-      try:
-	sys.modules[mod].qCleanupResources()
-      except:
-	pass
+    try:
+      if hasattr(sys.modules[mod], 'qCleanupResources'):
+        sys.modules[mod].qCleanupResources()
+    except:
+      pass
     # try to remove the module from python
     try:
       del sys.modules[mod]



More information about the QGIS-commit mailing list