From 9d4f2266ee06acc69f312cf2d67047ff74d60b95 Mon Sep 17 00:00:00 2001 From: Nils Philippsen Date: Thu, 7 Apr 2022 17:09:57 +0200 Subject: [PATCH] Cast more values to int to avoid crashes Signed-off-by: Nils Philippsen --- .../support/mixer-qt4/ffado/widgets/matrixmixer.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libffado/support/mixer-qt4/ffado/widgets/matrixmixer.py b/libffado/support/mixer-qt4/ffado/widgets/matrixmixer.py index f63f6fc7..6da8bf40 100644 --- a/libffado/support/mixer-qt4/ffado/widgets/matrixmixer.py +++ b/libffado/support/mixer-qt4/ffado/widgets/matrixmixer.py @@ -210,7 +210,9 @@ class MixerNode(QAbstractSlider): newpos = ev.posF() if ffado_pyqt_version == 4 else ev.localPos() change = newpos.y() - self.pos.y() #log.debug("MixerNode.mouseReleaseEvent() change %s" % (str(change))) - self.setValue( self.tmpvalue - math.copysign(pow(abs(change), 2), change) ) + self.setValue( + int(self.tmpvalue - math.copysign(pow(abs(change), 2), change)) + ) ev.accept() def mouseReleaseEvent(self, ev): @@ -218,7 +220,9 @@ class MixerNode(QAbstractSlider): newpos = ev.posF() if ffado_pyqt_version == 4 else ev.localPos() change = newpos.y() - self.pos.y() #log.debug("MixerNode.mouseReleaseEvent() change %s" % (str(change))) - self.setValue( self.tmpvalue - math.copysign(pow(abs(change), 2), change) ) + self.setValue( + int(self.tmpvalue - math.copysign(pow(abs(change), 2), change)) + ) self.pos = QtCore.QPointF(0, 0) del self.tmpvalue ev.accept() @@ -229,7 +233,9 @@ class MixerNode(QAbstractSlider): if (ev.modifiers() & Qt.ControlModifier): tmpvalue = self.value() change = ev.delta()/8 - self.setValue( tmpvalue + math.copysign(pow(abs(change), 2), change) ) + self.setValue( + int(self.tmpvalue - math.copysign(pow(abs(change), 2), change)) + ) ev.accept() else: ev.ignore() -- 2.35.1