Skip to content

Commit

Permalink
wxGUI: fix d.mon rendering OSGeo#3896, caused by garbage collection o…
Browse files Browse the repository at this point in the history
…f maplayer resulting in deleting mapfile
  • Loading branch information
petrasovaa authored and landam committed Jan 28, 2020
1 parent 51642fa commit 34afeee
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions gui/wxpython/mapdisp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

from grass.script.utils import try_remove
from grass.script import core as grass
from grass.script.task import cmdtuple_to_list
from grass.script.task import cmdtuple_to_list, cmdlist_to_tuple
from grass.pydispatch.signal import Signal

# for standalone app
Expand Down Expand Up @@ -215,23 +215,10 @@ def GetLayersFromCmdFile(self):
classLayer = MapLayer
args['ltype'] = ltype

mapLayer = classLayer(name=name,
cmd=cmd,
Map=None,
hidden=True,
render=False,
mapfile=mapFile,
**args)
mapLayer.GetRenderMgr().updateProgress.connect(self.GetRenderMgr().ReportProgress)
if render_env:
mapLayer.GetRenderMgr().UpdateRenderEnv(render_env)
render_env = dict()

exists = False
for i, layer in enumerate(existingLayers):
if layer.GetCmd(
string=True) == mapLayer.GetCmd(
string=True):
string=True) == utils.GetCmdString(cmdlist_to_tuple(cmd)):
exists = True

if layersOrder[i] == -1:
Expand All @@ -249,6 +236,18 @@ def GetLayersFromCmdFile(self):
if exists:
continue

mapLayer = classLayer(name=name,
cmd=cmd,
Map=None,
hidden=True,
render=False,
mapfile=mapFile,
**args)
mapLayer.GetRenderMgr().updateProgress.connect(self.GetRenderMgr().ReportProgress)
if render_env:
mapLayer.GetRenderMgr().UpdateRenderEnv(render_env)
render_env = dict()

newLayer = self._addLayer(mapLayer)

existingLayers.append(newLayer)
Expand Down

0 comments on commit 34afeee

Please sign in to comment.