From 74262a5dace5338444a6599e65d97c3b98968c96 Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 19 Aug 2024 20:33:57 +0200 Subject: [PATCH] Fix missing painter.restore() in case of CanvasPort errors Signed-off-by: falkTX --- source/frontend/patchcanvas/canvasport.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/frontend/patchcanvas/canvasport.py b/source/frontend/patchcanvas/canvasport.py index 045b7d06bd..98f89ad345 100644 --- a/source/frontend/patchcanvas/canvasport.py +++ b/source/frontend/patchcanvas/canvasport.py @@ -378,6 +378,7 @@ def paint(self, painter, option, widget): conn_pen = QPen(theme.port_parameter_pen_sel) else: qCritical("PatchCanvas::CanvasPort.paint() - invalid port type '%s'" % port_type2str(self.m_port_type)) + painter.restore() return # To prevent quality worsening @@ -414,6 +415,7 @@ def paint(self, painter, option, widget): poly_locx[4] = lineHinting else: qCritical("PatchCanvas::CanvasPort.paint() - invalid theme port mode '%s'" % canvas.theme.port_mode) + painter.restore() return elif self.m_port_mode == PORT_MODE_OUTPUT: @@ -433,10 +435,12 @@ def paint(self, painter, option, widget): poly_locx[4] = self.m_port_width + 12 - lineHinting else: qCritical("PatchCanvas::CanvasPort.paint() - invalid theme port mode '%s'" % canvas.theme.port_mode) + painter.restore() return else: qCritical("PatchCanvas::CanvasPort.paint() - invalid port mode '%s'" % port_mode2str(self.m_port_mode)) + painter.restore() return polygon = QPolygonF()