refactor(dab): extract sdr_id/center_freq before try block in _getDemodulator

Avoids calling getId() and props["center_freq"] twice — previously if the
second call raised after acquire() succeeded, the refcount would leak.
In practice both calls are infallible, but extracting them is cleaner.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Denny Ma 2026-03-15 18:40:37 +11:00
parent 7043356121
commit fa66bb44c4

View file

@ -586,13 +586,11 @@ class DspManager(SdrSourceEventClient, ClientDemodulatorSecondaryDspEventClient)
elif demod == "dab":
from csdr.chain.dablin import Dablin
from owrx.dab.manager import DabDecoderManager
sdr_id = self.sdrSource.getId()
center_freq = self.props["center_freq"]
try:
shared = DabDecoderManager.getShared().acquire(
self.sdrSource.getId(),
self.props["center_freq"],
self.sdrSource,
)
self._dabKey = (self.sdrSource.getId(), self.props["center_freq"])
shared = DabDecoderManager.getShared().acquire(sdr_id, center_freq, self.sdrSource)
self._dabKey = (sdr_id, center_freq)
return Dablin(shared_decoder=shared)
except Exception:
logger.exception("Shared DAB decoder failed, falling back to standalone")