SerializerLess::~SerializerLess() { if(m_ref) { DecRef(); } }
SocketMgr::~SocketMgr() { ShutdownThreads(); if (m_hThreads != NULL) delete [] m_hThreads; DecRef(); }
void SocketMgr::Shutdown() { if (m_bShutdown) return; ShutdownThreads(); DecRef(); m_bShutdown = true; }2
void CheckDone() { if (mChannel>=0 && sDoneChannel[mChannel]) { sDoneChannel[mChannel] = false; int c = mChannel; mChannel = -1; DecRef(); sUsedChannel[c] = 0; } }
void DrThread::DetachFromCurrentThread() { LogAssert(t_pThread == this); t_pThread = NULL; DrLogD( "DrThread::AttachToCurrentThread. %s, pThread=%p", m_strClass.GetString(), this); m_dwThreadId = 0; LogAssert(m_hThread == NULL); m_strTag = "INVL"; m_strDescription = "Unattached Thread"; DecRef(); // "this" may no longer exist }
void CheckDone() { if (mPlaying && (sDoneMusic || (sUsedMusic!=this)) ) { mPlaying = false; if (sUsedMusic == this) { sUsedMusic = 0; sDoneMusic = false; } DecRef(); } }
void HawkRefCounter::Release() { //判断引用计数有效,避免无效对象释放 A_Exception(m_iRef > 0 && "RefCounter Is Error."); DecRef(); //删除对象 if (m_iRef <= 0) { delete this; } }
void CheckDone() { if (mPlaying && (sDoneMusic || (sUsedMusic!=this)) ) { mLength = SDL_GetTicks () - mStartTime; mPlaying = false; if (sUsedMusic == this) { sUsedMusic = 0; sDoneMusic = false; } DecRef(); } }
iBase *scfFactory::CreateInstance () { IncRef (); // If IncRef won't succeed, we'll have a zero reference counter if (!scfRefCount) return 0; iBase *instance = CreateFunc(this); csRefTrackerAccess::SetDescriptionWeak (instance, ClassID); // No matter whenever we succeeded or not, decrement the refcount DecRef (); return instance; }
void OBSBasicStatusBar::StreamStopped() { if (streamOutput) { signal_handler_disconnect( obs_output_get_signal_handler(streamOutput), "reconnect", OBSOutputReconnect, this); signal_handler_disconnect( obs_output_get_signal_handler(streamOutput), "reconnect_success", OBSOutputReconnectSuccess, this); streamOutput = nullptr; clearMessage(); DecRef(); } }
void LabelDialog::OnCancel(wxCommandEvent & WXUNUSED(event)) { if (mGrid->IsCellEditControlShown()) { auto editor = mGrid->GetCellEditor(mGrid->GetGridCursorRow(), mGrid->GetGridCursorCol()); editor->Reset(); // To avoid memory leak, don't forget DecRef()! editor->DecRef(); mGrid->HideCellEditControl(); return; } // Standard handling EndModal(wxID_CANCEL); return; }
gralloc1_error_t BufferManager::ReleaseBuffer(private_handle_t const *hnd) { if (hnd->flags & private_handle_t::PRIV_FLAGS_CLIENT_ALLOCATED) { return GRALLOC1_ERROR_NONE; } ALOGD_IF(DEBUG, "Release buffer handle:%p id: %" PRIu64, hnd, hnd->id); std::lock_guard<std::mutex> lock(buffer_lock_); auto buf = GetBufferFromHandleLocked(hnd); if (buf == nullptr) { ALOGE("Could not find handle: %p id: %" PRIu64, hnd, hnd->id); return GRALLOC1_ERROR_BAD_HANDLE; } else { if (buf->DecRef()) { handles_map_.erase(hnd); // Unmap, close ion handle and close fd FreeBuffer(buf); } } return GRALLOC1_ERROR_NONE; }
void TagsEditor::DoCancel(bool escKey) { if (mGrid->IsCellEditControlShown()) { auto editor = mGrid->GetCellEditor(mGrid->GetGridCursorRow(), mGrid->GetGridCursorCol()); editor->Reset(); // To avoid memory leak, don't forget DecRef()! editor->DecRef(); mGrid->HideCellEditControl(); #if defined(__WXMSW__) return; #endif } auto focus = wxWindow::FindFocus(); if (escKey && focus == mGrid) return; EndModal(wxID_CANCEL); }
void TagsEditor::PopulateGenres() { int cnt = mLocal.GetNumUserGenres(); int i; wxString parm; wxArrayString g; for (i = 0; i < cnt; i++) { g.push_back(mLocal.GetUserGenre(i)); } std::sort( g.begin(), g.end() ); for (i = 0; i < cnt; i++) { parm = parm + (i == 0 ? wxT("") : wxT(",")) + g[i]; } // Here was a memory leak! wxWidgets docs for wxGrid::GetDefaultEditorForType() say: // "The caller must call DecRef() on the returned pointer." auto editor = mGrid->GetDefaultEditorForType(wxT("Combo")); editor->SetParameters(parm); editor->DecRef(); }
//.gm blockwhispers bool ChatHandler::HandleGMBlockWhispersCommand(const char* args, WorldSession* m_session) { if (args == 0) { RedSystemMessage(m_session, "No playername set."); RedSystemMessage(m_session, "Use .gm blockwhispers <playername>"); return true; } auto player_cache = objmgr.GetPlayerCache(args, false); if (player_cache == nullptr) { RedSystemMessage(m_session, "Player %s not found.", args); return true; } m_session->GetPlayer()->m_cache->RemoveValue64(CACHE_GM_TARGETS, player_cache->GetUInt32Value(CACHE_PLAYER_LOWGUID)); std::string name; player_cache->GetStringValue(CACHE_PLAYER_NAME, name); BlueSystemMessage(m_session, "Now blocking whispers from %s.", name.c_str()); player_cache->DecRef(); return true; }
~JsonHandle() { DecRef(); }
void OBSBasicStatusBar::RecordingStopped() { recordOutput = nullptr; DecRef(); }
/// Attach newly created object without incrementing ref count (it's already == 1). void AttachNew(json_struct_t * pJson) { DecRef(); m_pJson = pJson; }