UI: Fix leak with paint event of volume slider

This fixes a memory leak introduced in [1] where a new QColor is not
balanced by a delete.

[1] UI: Update volume meter appearance
https://github.com/obsproject/obs-studio/commit/52ae5fc4bd518c67edd8ab94121ace05d9076892

Signed-off-by: pkv <pkv@obsproject.com>
This commit is contained in:
pkv
2024-08-03 16:27:17 -07:00
committed by Lain
parent ff2fa24dc2
commit 19abab097d
+3 -4
View File
@@ -1557,8 +1557,7 @@ void VolumeSlider::paintEvent(QPaintEvent *event)
}
QPainter painter(this);
QColor *tickColor = new QColor;
tickColor->setRgb(91, 98, 115, 255);
QColor tickColor(91, 98, 115, 255);
obs_fader_conversion_t fader_db_to_def = obs_fader_db_to_def(fad);
@@ -1584,7 +1583,7 @@ void VolumeSlider::paintEvent(QPaintEvent *event)
float xPos = groove.left() + (tickValue * sliderWidth) +
(handle.width() / 2);
painter.fillRect(xPos, yPos, 1, tickLength, *tickColor);
painter.fillRect(xPos, yPos, 1, tickLength, tickColor);
}
}
@@ -1603,7 +1602,7 @@ void VolumeSlider::paintEvent(QPaintEvent *event)
float yPos = groove.height() + groove.top() -
(tickValue * sliderHeight) -
(handle.height() / 2);
painter.fillRect(xPos, yPos, tickLength, 1, *tickColor);
painter.fillRect(xPos, yPos, tickLength, 1, tickColor);
}
}