From 3b79a73470ecc34f9780ad16e469e7047b10cd7f Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 24 Jun 2013 17:23:22 +0100 Subject: [PATCH] Fix crash on canvas reinit --- source/patchcanvas.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/source/patchcanvas.py b/source/patchcanvas.py index c97b52e10..a6e99e6eb 100644 --- a/source/patchcanvas.py +++ b/source/patchcanvas.py @@ -1076,15 +1076,24 @@ class PatchScene(QGraphicsScene): self.m_mouse_down_init = False self.m_mouse_rubberband = False + self.addRubberBand() + + self.m_view = view + if not self.m_view: + qFatal("PatchCanvas::PatchScene() - invalid view") + + def addRubberBand(self): self.m_rubberband = self.addRect(QRectF(0, 0, 0, 0)) self.m_rubberband.setZValue(-1) self.m_rubberband.hide() self.m_rubberband_selection = False self.m_rubberband_orig_point = QPointF(0, 0) - self.m_view = view - if not self.m_view: - qFatal("PatchCanvas::PatchScene() - invalid view") + def clear(self): + QGraphicsScene.clear(self) + + # Re-add rubberband, that just got deleted + self.addRubberBand() def fixScaleFactor(self): scale = self.m_view.transform().m11()