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
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
BlackBorderProcessor(Hyperion* hyperion, QObject* parent);
|
BlackBorderProcessor(Hyperion* hyperion, QObject* parent);
|
||||||
~BlackBorderProcessor() override;
|
|
||||||
///
|
///
|
||||||
/// Return the current (detected) border
|
/// Return the current (detected) border
|
||||||
/// @return The current border
|
/// @return The current border
|
||||||
@@ -141,7 +141,7 @@ namespace hyperion
|
|||||||
QString _detectionMode;
|
QString _detectionMode;
|
||||||
|
|
||||||
/// The black-border detector
|
/// The black-border detector
|
||||||
BlackBorderDetector* _detector;
|
std::unique_ptr<BlackBorderDetector> _detector;
|
||||||
|
|
||||||
/// The current detected border
|
/// The current detected border
|
||||||
BlackBorder _currentBorder;
|
BlackBorder _currentBorder;
|
||||||
|
@@ -35,12 +35,7 @@ BlackBorderProcessor::BlackBorderProcessor(Hyperion* hyperion, QObject* parent)
|
|||||||
// listen for component state changes
|
// listen for component state changes
|
||||||
connect(_hyperion, &Hyperion::compStateChangeRequest, this, &BlackBorderProcessor::handleCompStateChangeRequest);
|
connect(_hyperion, &Hyperion::compStateChangeRequest, this, &BlackBorderProcessor::handleCompStateChangeRequest);
|
||||||
|
|
||||||
_detector = new BlackBorderDetector(_oldThreshold);
|
_detector = std::make_unique<BlackBorderDetector>(_oldThreshold);
|
||||||
}
|
|
||||||
|
|
||||||
BlackBorderProcessor::~BlackBorderProcessor()
|
|
||||||
{
|
|
||||||
delete _detector;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlackBorderProcessor::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
|
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())
|
if (fabs(_oldThreshold - newThreshold) > std::numeric_limits<double>::epsilon())
|
||||||
{
|
{
|
||||||
_oldThreshold = newThreshold;
|
_oldThreshold = newThreshold;
|
||||||
|
_detector = std::make_unique<BlackBorderDetector>(_oldThreshold);
|
||||||
delete _detector;
|
|
||||||
|
|
||||||
_detector = new BlackBorderDetector(newThreshold);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug(Logger::getInstance("BLACKBORDER", "I"+QString::number(_hyperion->getInstanceIndex())), "Set mode to: %s", QSTRING_CSTR(_detectionMode));
|
Debug(Logger::getInstance("BLACKBORDER", "I"+QString::number(_hyperion->getInstanceIndex())), "Set mode to: %s", QSTRING_CSTR(_detectionMode));
|
||||||
|
Reference in New Issue
Block a user