You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libffado/0001-Cast-more-values-to-in...

51 lines
2.2 KiB

From 9d4f2266ee06acc69f312cf2d67047ff74d60b95 Mon Sep 17 00:00:00 2001
From: Nils Philippsen <nils@tiptoe.de>
Date: Thu, 7 Apr 2022 17:09:57 +0200
Subject: [PATCH] Cast more values to int to avoid crashes
Signed-off-by: Nils Philippsen <nils@tiptoe.de>
---
.../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