mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-14 09:37:36 -05:00
#2055 MultiFrequencyTunerChannelSource Null Pointer Error On Channel Source Shutdown - different solution to resolve possible memory leak with previous solution. Also fixes P25 issue where a traffic channel that doesn't get started is returned to the traffic channel pool. (#2070)
Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
@@ -252,11 +252,16 @@ public class PolyphaseChannelManager implements ISourceEventProcessor
|
|||||||
synchronized(mBufferDispatcher)
|
synchronized(mBufferDispatcher)
|
||||||
{
|
{
|
||||||
mChannelSources.remove(channelSource);
|
mChannelSources.remove(channelSource);
|
||||||
mPolyphaseChannelizer.removeChannel(channelSource);
|
|
||||||
|
if(mPolyphaseChannelizer != null)
|
||||||
|
{
|
||||||
|
mPolyphaseChannelizer.removeChannel(channelSource);
|
||||||
|
}
|
||||||
|
|
||||||
mSourceEventBroadcaster.broadcast(SourceEvent.channelCountChange(getTunerChannelCount()));
|
mSourceEventBroadcaster.broadcast(SourceEvent.channelCountChange(getTunerChannelCount()));
|
||||||
|
|
||||||
//If this is the last/only channel, deregister to stop the sample buffers
|
//If this is the last/only channel, deregister to stop the sample buffers
|
||||||
if(mPolyphaseChannelizer.getRegisteredChannelCount() == 0)
|
if(mPolyphaseChannelizer != null && mPolyphaseChannelizer.getRegisteredChannelCount() == 0)
|
||||||
{
|
{
|
||||||
mNativeBufferProvider.removeBufferListener(mBufferDispatcher);
|
mNativeBufferProvider.removeBufferListener(mBufferDispatcher);
|
||||||
mBufferDispatcher.stop();
|
mBufferDispatcher.stop();
|
||||||
|
|||||||
@@ -1086,6 +1086,18 @@ public class P25TrafficChannelManager extends TrafficChannelManager implements I
|
|||||||
startChannelRequest.addPreloadDataContent(new P25FrequencyBandPreloadDataContent(mFrequencyBandMap.values()));
|
startChannelRequest.addPreloadDataContent(new P25FrequencyBandPreloadDataContent(mFrequencyBandMap.values()));
|
||||||
getInterModuleEventBus().post(startChannelRequest);
|
getInterModuleEventBus().post(startChannelRequest);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Return the channel to the traffic channel pool since we didn't start it.
|
||||||
|
if(mManagedPhase1TrafficChannels.contains(trafficChannel))
|
||||||
|
{
|
||||||
|
mAvailablePhase1TrafficChannelQueue.add(trafficChannel);
|
||||||
|
}
|
||||||
|
else if(mManagedPhase2TrafficChannels.contains(trafficChannel))
|
||||||
|
{
|
||||||
|
mAvailablePhase2TrafficChannelQueue.add(trafficChannel);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -153,19 +153,13 @@ public class MultiFrequencyTunerChannelSource extends TunerChannelSource
|
|||||||
@Override
|
@Override
|
||||||
public void stop()
|
public void stop()
|
||||||
{
|
{
|
||||||
//Don't perform stop sequence if we haven't been started. There can be a small window on startup where the
|
mStarted = false;
|
||||||
//channel rotation monitor can get ahead of the channel source and cause it to try to stop and rotate before
|
|
||||||
//it has even started, causing an error in the polyphase channel source.
|
|
||||||
if(mStarted)
|
|
||||||
{
|
|
||||||
mStarted = false;
|
|
||||||
|
|
||||||
if(mTunerChannelSource != null)
|
if(mTunerChannelSource != null)
|
||||||
{
|
{
|
||||||
mTunerChannelSource.stop();
|
mTunerChannelSource.stop();
|
||||||
mTunerChannelSource.removeSourceEventListener();
|
mTunerChannelSource.removeSourceEventListener();
|
||||||
mTunerChannelSource = null;
|
mTunerChannelSource = null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user