mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Fix Memory leak in BlackBorderProcessor
This commit is contained in:
@@ -24,7 +24,7 @@ namespace hyperion
|
||||
Q_OBJECT
|
||||
public:
|
||||
BlackBorderProcessor(Hyperion* hyperion, QObject* parent);
|
||||
~BlackBorderProcessor() override;
|
||||
|
||||
///
|
||||
/// Return the current (detected) border
|
||||
/// @return The current border
|
||||
@@ -141,7 +141,7 @@ namespace hyperion
|
||||
QString _detectionMode;
|
||||
|
||||
/// The black-border detector
|
||||
BlackBorderDetector* _detector;
|
||||
std::unique_ptr<BlackBorderDetector> _detector;
|
||||
|
||||
/// The current detected border
|
||||
BlackBorder _currentBorder;
|
||||
|
@@ -35,12 +35,7 @@ BlackBorderProcessor::BlackBorderProcessor(Hyperion* hyperion, QObject* parent)
|
||||
// listen for component state changes
|
||||
connect(_hyperion, &Hyperion::compStateChangeRequest, this, &BlackBorderProcessor::handleCompStateChangeRequest);
|
||||
|
||||
_detector = new BlackBorderDetector(_oldThreshold);
|
||||
}
|
||||
|
||||
BlackBorderProcessor::~BlackBorderProcessor()
|
||||
{
|
||||
delete _detector;
|
||||
_detector = std::make_unique<BlackBorderDetector>(_oldThreshold);
|
||||
}
|
||||
|
||||
void BlackBorderProcessor::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
|
||||
@@ -66,10 +61,7 @@ void BlackBorderProcessor::handleSettingsUpdate(settings::type type, const QJson
|
||||
if (fabs(_oldThreshold - newThreshold) > std::numeric_limits<double>::epsilon())
|
||||
{
|
||||
_oldThreshold = newThreshold;
|
||||
|
||||
delete _detector;
|
||||
|
||||
_detector = new BlackBorderDetector(newThreshold);
|
||||
_detector = std::make_unique<BlackBorderDetector>(_oldThreshold);
|
||||
}
|
||||
|
||||
Debug(Logger::getInstance("BLACKBORDER", "I"+QString::number(_hyperion->getInstanceIndex())), "Set mode to: %s", QSTRING_CSTR(_detectionMode));
|
||||
|
Reference in New Issue
Block a user