mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -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:
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user