Commit b1124905 authored by Guillaume Seguin's avatar Guillaume Seguin

Fix crasher in 2D viewer by ignoring too small resizes #520

(also add a SelectObject for cleanliness even though the dc
is going to get destroyed at the end of the function)
parent 4cadd72c
...@@ -268,7 +268,10 @@ class Gviz(wx.Panel): ...@@ -268,7 +268,10 @@ class Gviz(wx.Panel):
def resize(self, event): def resize(self, event):
old_basescale = self.basescale old_basescale = self.basescale
self.size = self.GetClientSizeTuple() width, height = self.GetClientSizeTuple()
if width < 1 or height < 1:
return
self.size = (width, height)
self.update_basescale() self.update_basescale()
zoomratio = float(self.basescale[0]) / old_basescale[0] zoomratio = float(self.basescale[0]) / old_basescale[0]
wx.CallLater(200, self.zoom, 0, 0, zoomratio) wx.CallLater(200, self.zoom, 0, 0, zoomratio)
...@@ -385,6 +388,7 @@ class Gviz(wx.Panel): ...@@ -385,6 +388,7 @@ class Gviz(wx.Panel):
while not self.hilightarcsqueue.empty(): while not self.hilightarcsqueue.empty():
hlarcs.append(self.hilightarcsqueue.get_nowait()) hlarcs.append(self.hilightarcsqueue.get_nowait())
self._drawarcs(dc, hlarcs, self.hlpen) self._drawarcs(dc, hlarcs, self.hlpen)
dc.SelectObject(wx.NullBitmap)
def paint(self, event): def paint(self, event):
if self.dirty: if self.dirty:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment