Really delete processing dialogs

The dialogs are parented to the main window, which means sip
transfers the ownership to the main window - and they are
never deleted as a result. This results in various error
messages caused by the widgets hanging around forever
and listening out for various signals they are connected to.
This commit is contained in:
Nyall Dawson 2017-07-12 18:52:53 +10:00
parent 77351fdba4
commit 5c844a5cfb
5 changed files with 19 additions and 0 deletions

View File

@ -88,6 +88,9 @@ class AlgorithmLocatorFilter(QgsLocatorFilter):
prevMapTool = canvas.mapTool()
dlg.show()
dlg.exec_()
# have to manually delete the dialog - otherwise it's owned by the
# iface mainWindow and never deleted
del dlg
if canvas.mapTool() != prevMapTool:
try:
canvas.mapTool().reset()

View File

@ -250,6 +250,9 @@ class ProcessingToolbox(BASE, WIDGET):
dlg = BatchAlgorithmDialog(alg)
dlg.show()
dlg.exec_()
# have to manually delete the dialog - otherwise it's owned by the
# iface mainWindow and never deleted
del dlg
def executeAlgorithm(self):
item = self.algorithmTree.currentItem()
@ -288,6 +291,9 @@ class ProcessingToolbox(BASE, WIDGET):
ProcessingConfig.SHOW_RECENT_ALGORITHMS)
if showRecent:
self.addRecentAlgorithms(True)
# have to manually delete the dialog - otherwise it's owned by the
# iface mainWindow and never deleted
del dlg
else:
feedback = MessageBarProgress()
context = dataobjects.createContext(feedback)

View File

@ -279,6 +279,10 @@ class ScriptEditorDialog(BASE, WIDGET):
dlg.show()
dlg.exec_()
# have to manually delete the dialog - otherwise it's owned by the
# iface mainWindow and never deleted
del dlg
if canvas.mapTool() != prevMapTool:
try:
canvas.mapTool().reset()

View File

@ -211,6 +211,9 @@ def _executeAlgorithm(alg):
prevMapTool = canvas.mapTool()
dlg.show()
dlg.exec_()
# have to manually delete the dialog - otherwise it's owned by the
# iface mainWindow and never deleted
del dlg
if canvas.mapTool() != prevMapTool:
try:
canvas.mapTool().reset()

View File

@ -291,6 +291,9 @@ class ModelerDialog(BASE, WIDGET):
dlg = AlgorithmDialog(self.model)
dlg.exec_()
# have to manually delete the dialog - otherwise it's owned by the
# iface mainWindow and never deleted
del dlg
def save(self):
self.saveModel(False)