MythTV
master
|
General purpose reference counter. More...
#include <libmythbase/referencecounter.h>
Public Member Functions | |
ReferenceCounter (const QString &debugName, bool logDebug=true) | |
Creates reference counter with an initial value of 1. More... | |
virtual int | IncrRef (void) |
Increments reference count. More... | |
virtual int | DecrRef (void) |
Decrements reference count and deletes on 0. More... | |
Static Public Member Functions | |
static void | PrintDebug (void) |
Print out any leaks if that level of debugging is enabled. More... | |
Protected Member Functions | |
virtual | ~ReferenceCounter (void) |
Called on destruction, will warn if object deleted with references in place. More... | |
Protected Attributes | |
bool | m_logDebug |
This is used to suppress creating LoggingItem classes for LoggingItem reference count changes. More... | |
QAtomicInt | m_referenceCount {1} |
General purpose reference counter.
This class uses QAtomicInt for lockless reference counting.
Definition at line 26 of file referencecounter.h.
Creates reference counter with an initial value of 1.
Definition at line 75 of file referencecounter.cpp.
|
protectedvirtual |
Called on destruction, will warn if object deleted with references in place.
Set breakpoint here for debugging.
Definition at line 88 of file referencecounter.cpp.
|
virtual |
Increments reference count.
Reimplemented in MythImage.
Definition at line 101 of file referencecounter.cpp.
Referenced by MythVDPAUInterop::Acquire(), MythPower::AcquireRelease(), TV::AcquireRelease(), SSDPCache::Add(), UPnpCDSExtensionResults::Add(), MythCommandLineParser::add(), CDSObject::AddChild(), DeleteThread::AddFile(), BackendSelection::AddItem(), MythSocketManager::AddSocketHandler(), TaskQueue::AddTaskAbsolute(), MythSystemLegacyManager::append(), BEProcessRequestRunnable::BEProcessRequestRunnable(), MainServer::connectionClosed(), MythCodecContext::CreateDevice(), SSDPCacheEntries::Find(), MythSocketManager::GetConnectionBySocket(), MythDVDBuffer::GetDVDContext(), SSDPCacheEntries::GetFirst(), GuideGrid::GuideGrid(), MainServer::HandleAnnounce(), FileServerHandler::HandleFileQuery(), MainServer::HandleFileTransferQuery(), FileServerHandler::HandleGetFileList(), FileServerHandler::HandleQueryFileTransfer(), EncoderLink::HasSockAndIncrRef(), MythImage::IncrRef(), SSDPCacheEntries::Insert(), LoggerThread::logConsole(), logForwardMessage(), MythD3D9Painter::MythD3D9Painter(), MythInteropGPU::MythInteropGPU(), MythOpenGLTonemap::MythOpenGLTonemap(), MythVideoDRM::MythVideoDRM(), MythVideoGPU::MythVideoGPU(), MythVideoOutputGPU::MythVideoOutputGPU(), GameUI::OnGameSearchListSelection(), MetadataFactory::OnSingleResult(), VideoDialog::OnVideoSearchListSelection(), PlaybackBox::PlaybackBox(), ProcessRequestRunnable::ProcessRequestRunnable(), ProgFinder::ProgFinder(), ProgLister::ProgLister(), PlaybackSock::ReadStringList(), SSDPCache::Remove(), SSDPCache::RemoveStale(), MetadataDownload::run(), ScheduleEditor::ScheduleEditor(), PlaybackSock::SendReceiveStringList(), CommandLineArg::SetBlocks(), CommandLineArg::SetChildOf(), CommandLineArg::SetParentOf(), CommandLineArg::SetRequires(), EncoderLink::SetSocket(), SocketHandler::SocketHandler(), TVRec::SpawnLiveTV(), and ViewScheduled::ViewScheduled().
|
virtual |
Decrements reference count and deletes on 0.
Reimplemented in MythImage.
Definition at line 125 of file referencecounter.cpp.
Referenced by MythPower::AcquireRelease(), TV::AcquireRelease(), SSDPCache::Add(), MetadataImageDownload::addDownloads(), MetadataDownload::addLookup(), RemoteFile::Close(), MythDVDBuffer::CloseDVD(), MythCoreContext::ConnectCommandSocket(), MythSocketManager::connectionClosed(), MainServer::connectionClosed(), ZMClient::connectToHost(), MythCoreContext::ConnectToMasterServer(), CreateMetadataXML(), BackendSelection::customEvent(), MythImage::DecrRef(), MythContextPrivate::DefaultUPnP(), MainServer::deferredDeleteSlot(), MainServer::DeleteChain(), VideoOutputD3D::DestroyContext(), MythCodecContext::DestroyInterop(), OutboundRequestHandler::DoConnectToMaster(), MainServer::DoHandleDeleteRecording(), MainServer::DoHandleStopRecording(), SatIP::doUPNPsearch(), VBox::doUPNPSearch(), HttpStatus::FillStatusXML(), V2Status::FillStatusXML(), SSDPCache::Find(), FileServerHandler::HandleAnnounce(), MainServer::HandleAnnounce(), MainServer::HandleCheckRecordingActive(), FileServerHandler::HandleFileQuery(), MainServer::HandleFileTransferQuery(), MainServer::HandleGenPreviewPixmap(), FileServerHandler::HandleGetFileList(), MainServer::HandleIsActiveBackendQuery(), MainServer::HandleMusicCalcTrackLen(), MainServer::HandleMusicFindAlbumArt(), MainServer::HandleMusicFindLyrics(), MainServer::HandleMusicSaveLyrics(), MainServer::HandleMusicTagAddImage(), MainServer::HandleMusicTagChangeImage(), MainServer::HandleMusicTagGetImage(), MainServer::HandleMusicTagRemoveImage(), MainServer::HandleMusicTagUpdateMetadata(), MainServer::HandleMusicTagUpdateVolatile(), MainServer::HandlePixmapGetIfModified(), MainServer::HandlePixmapLastModified(), MainServer::HandleQueryCheckFile(), MainServer::HandleQueryFileHash(), FileServerHandler::HandleQueryFileTransfer(), MainServer::HandleQueryFindFile(), MainServer::HandleQueryRecordings(), MainServer::HandleScanMusic(), MainServer::HandleSGFileQuery(), MainServer::HandleSGGetFileList(), EncoderLink::HasSockAndDecrRef(), BackendSelection::Init(), MythVAAPIContext::InitialiseContext(), UPnpCDSMusic::LoadAlbums(), UPnpCDSMusic::LoadArtists(), UPnpCDSTv::LoadChannels(), UPnpCDSTv::LoadDates(), UPnpCDSTv::LoadGenres(), UPnpCDSMusic::LoadGenres(), UPnpCDSVideo::LoadGenres(), UPnpCDSTv::LoadRecGroups(), UPnpCDSTv::LoadRecordings(), UPnpCDSVideo::LoadSeasons(), UPnpCDSVideo::LoadSeries(), UPnpCDSTv::LoadTitles(), UPnpCDSMusic::LoadTracks(), UPnpCDSVideo::LoadVideos(), LoggerThread::logConsole(), LogPrintLine(), MythDVDBuffer::OpenFile(), GuideGrid::PlayerExiting(), MetadataDownload::prependLookup(), DeleteThread::ProcessNew(), DeleteThread::ProcessOld(), HouseKeeper::RegisterTask(), MythDVDDecoder::ReleaseContext(), RemoteGetFileList(), RemoteSendReceiveStringList(), SSDPCache::Remove(), SSDPCache::RemoveStale(), ProcessRequestRunnable::run(), MythSystemLegacySignalManager::run(), LogForwardThread::run(), TaskQueue::run(), LoggerThread::run(), BEProcessRequestRunnable::run(), MythDVDBuffer::SafeRead(), RemoteEncoder::SendReceiveStringList(), PlaybackSock::SendReceiveStringList(), MythCoreContext::SendReceiveStringList(), PlayerContext::SetTVChain(), MythDVDBuffer::StartFromBeginning(), TVRec::StartRecording(), TVRec::StopLiveTV(), MythD3D9Painter::Teardown(), MythContextPrivate::UPnPautoconf(), BEFileTransfer::~BEFileTransfer(), BEProcessRequestRunnable::~BEProcessRequestRunnable(), GuideGrid::~GuideGrid(), MetadataFactoryNoResult::~MetadataFactoryNoResult(), MetadataFactorySingleResult::~MetadataFactorySingleResult(), MythInteropGPU::~MythInteropGPU(), MythOpenGLTonemap::~MythOpenGLTonemap(), MythPainterWindowOpenGL::~MythPainterWindowOpenGL(), MythSystemLegacy::~MythSystemLegacy(), MythVDPAUInterop::~MythVDPAUInterop(), MythVideoDRM::~MythVideoDRM(), MythVideoGPU::~MythVideoGPU(), MythVideoOutputGPU::~MythVideoOutputGPU(), PlaybackBox::~PlaybackBox(), PlaybackSock::~PlaybackSock(), ProgFinder::~ProgFinder(), ProgLister::~ProgLister(), RemoteEncoder::~RemoteEncoder(), RemoteFile::~RemoteFile(), ScheduleEditor::~ScheduleEditor(), SocketHandler::~SocketHandler(), SSDP::~SSDP(), UPnpCDSExtension::~UPnpCDSExtension(), ViewScheduled::~ViewScheduled(), and ZMClient::~ZMClient().
|
static |
Print out any leaks if that level of debugging is enabled.
Definition at line 72 of file referencecounter.cpp.
Referenced by anonymous_namespace{mythscreenwizard.cpp}::cleanup(), anonymous_namespace{mythfrontend.cpp}::cleanup(), and CleanupGuard::~CleanupGuard().
|
protected |
This is used to suppress creating LoggingItem classes for LoggingItem reference count changes.
This is necessary to prevent infinte recursion. If you need to debug LoggingItem reference counting you need to print the messages to the console by modifying IncrRef() and DecrRef().
Definition at line 56 of file referencecounter.h.
|
protected |
Definition at line 57 of file referencecounter.h.
Referenced by TV::AcquireRelease(), DecrRef(), IncrRef(), MythRender::IsShared(), and ~ReferenceCounter().