mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
#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:
@@ -49,13 +49,13 @@ public abstract class TunerController implements Tunable, ISourceEventProcessor,
|
||||
protected Broadcaster<INativeBuffer> mNativeBufferBroadcaster = new Broadcaster();
|
||||
protected FrequencyController mFrequencyController;
|
||||
private int mMiddleUnusableHalfBandwidth;
|
||||
private double mUsableBandwidthPercentage;
|
||||
private Listener<SourceEvent> mSourceEventListener;
|
||||
private int mMeasuredFrequencyError;
|
||||
private double mUsableBandwidthPercentage;
|
||||
private SourceEventListenerToProcessorAdapter mSourceEventListener;
|
||||
private NativeBufferWaveRecorder mRecorder;
|
||||
private ITunerErrorListener mTunerErrorListener;
|
||||
public FrequencyErrorCorrectionManager mFrequencyErrorCorrectionManager;
|
||||
private DecimalFormat mFrequencyErrorPPMFormat = new DecimalFormat("0.0");
|
||||
private FrequencyErrorCorrectionManager mFrequencyErrorCorrectionManager;
|
||||
|
||||
/**
|
||||
* Abstract tuner controller class. The tuner controller manages frequency bandwidth and currently tuned channels
|
||||
@@ -78,6 +78,15 @@ public abstract class TunerController implements Tunable, ISourceEventProcessor,
|
||||
return mFrequencyErrorCorrectionManager;
|
||||
}
|
||||
|
||||
protected void dispose()
|
||||
{
|
||||
getFrequencyErrorCorrectionManager().dispose();
|
||||
mNativeBufferBroadcaster.clear();
|
||||
mFrequencyController.dispose();
|
||||
mSourceEventListener.dispose();
|
||||
mTunerErrorListener = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform startup operations
|
||||
* @throws SourceException if there is an error that makes this tuner controller unusable
|
||||
@@ -141,7 +150,6 @@ public abstract class TunerController implements Tunable, ISourceEventProcessor,
|
||||
setFrequency(config.getFrequency());
|
||||
setFrequencyCorrection(config.getFrequencyCorrection());
|
||||
getFrequencyErrorCorrectionManager().setEnabled(config.getAutoPPMCorrectionEnabled());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user