Skip to content

Commit

Permalink
[processing] Fix crash when an algorithm dialog is left open and
Browse files Browse the repository at this point in the history
processing options are changed

Make sure the algorithm dialogs use their own copy of algorithms,
instead of the copies owned by the processing registry. Opening
processing options triggers a full reload of providers, deleting
all existing algorithm instances from the registry first.
  • Loading branch information
nyalldawson committed Sep 25, 2018
1 parent c2dab4f commit 6e06c32
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions python/plugins/processing/gui/ProcessingToolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def showPopupMenu(self, point):
popupmenu.exec_(self.algorithmTree.mapToGlobal(point))

def editRenderingStyles(self):
alg = self.algorithmTree.selectedAlgorithm()
alg = self.algorithmTree.selectedAlgorithm().create() if self.algorithmTree.selectedAlgorithm() is not None else None
if alg is not None:
dlg = EditRenderingStylesDialog(alg)
dlg.exec_()
Expand All @@ -210,14 +210,14 @@ def activateCurrent(self):
self.executeAlgorithm()

def executeAlgorithmAsBatchProcess(self):
alg = self.algorithmTree.selectedAlgorithm()
alg = self.algorithmTree.selectedAlgorithm().create() if self.algorithmTree.selectedAlgorithm() is not None else None
if alg is not None:
dlg = BatchAlgorithmDialog(alg)
dlg.show()
dlg.exec_()

def executeAlgorithm(self):
alg = self.algorithmTree.selectedAlgorithm()
alg = self.algorithmTree.selectedAlgorithm().create() if self.algorithmTree.selectedAlgorithm() is not None else None
if alg is not None:
ok, message = alg.canExecute()
if not ok:
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/tools/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def createAlgorithmDialog(algOrName, parameters={}):
and delete this dialog.
"""
if isinstance(algOrName, QgsProcessingAlgorithm):
alg = algOrName
alg = algOrName.create()
else:
alg = QgsApplication.processingRegistry().createAlgorithmById(algOrName)

Expand Down

0 comments on commit 6e06c32

Please sign in to comment.