Skip to content

Commit

Permalink
Fix missing painter.restore() in case of CanvasPort errors
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Aug 20, 2024
1 parent f5d4884 commit 74262a5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/frontend/patchcanvas/canvasport.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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()
Expand Down

0 comments on commit 74262a5

Please sign in to comment.