#1210 Resolves issue of tuner instances can't be garbage collected due to retained references. Updates several of the tuner controller and tuner editor classes to add/invoke dispose() methods to clear retained instance references. (#1216)

Co-authored-by: Denny Sheirer <sheirerd@ainfosec.com>
This commit is contained in:
Denny Sheirer
2022-04-24 04:56:10 -04:00
committed by GitHub
parent 1b90e0b50c
commit 25a42126df
11 changed files with 171 additions and 58 deletions

View File

@@ -36,6 +36,14 @@ public abstract class ChannelSourceManager implements ISourceEventProcessor
{
private Broadcaster<SourceEvent> mSourceEventBroadcaster = new Broadcaster<>();
/**
* Prepare for disposal
*/
public void dispose()
{
mSourceEventBroadcaster.clear();
}
/**
* Sorted set of tuner channels being sourced by this source manager. Set is ordered by frequency lowest to highest
*/

View File

@@ -49,6 +49,15 @@ public class FrequencyErrorCorrectionManager
mTunerController = tunerController;
}
/**
* Dispose of this manager instance and nullify references.
*/
public void dispose()
{
setEnabled(false);
mTunerController = null;
}
/**
* Enables or disables automatic frequency PPM correction.
* @param enabled to true to turn on automatic PPM adjustments.
@@ -80,7 +89,7 @@ public class FrequencyErrorCorrectionManager
*/
private void applyCorrection()
{
if(mEnabled && mTunerController.hasMeasuredFrequencyError())
if(mEnabled && mTunerController != null && mTunerController.hasMeasuredFrequencyError())
{
double frequencyCorrection = mTunerController.getFrequencyCorrection();
frequencyCorrection -= mTunerController.getPPMFrequencyError();