예제 #1
0
SerializerLess::~SerializerLess()
{
	if(m_ref)
	{
		DecRef();
	}
}
예제 #2
0
SocketMgr::~SocketMgr()
{
	ShutdownThreads();

	if (m_hThreads != NULL)
		delete [] m_hThreads;

	DecRef();
}
예제 #3
0
void SocketMgr::Shutdown()
{
	if (m_bShutdown)
		return;

	ShutdownThreads();

	DecRef();
	m_bShutdown = true;
}2
예제 #4
0
 void CheckDone()
 {
    if (mChannel>=0 && sDoneChannel[mChannel])
    {
       sDoneChannel[mChannel] = false;
       int c = mChannel;
       mChannel = -1;
       DecRef();
       sUsedChannel[c] = 0;
    }
 }
예제 #5
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
}
예제 #6
0
 void CheckDone()
 {
    if (mPlaying && (sDoneMusic || (sUsedMusic!=this)) )
    {
       mPlaying = false;
       if (sUsedMusic == this)
       {
          sUsedMusic = 0;
          sDoneMusic = false;
       }
       DecRef();
    }
 }
예제 #7
0
void HawkRefCounter::Release()
{
    //判断引用计数有效,避免无效对象释放
    A_Exception(m_iRef > 0 && "RefCounter Is Error.");

    DecRef();

    //删除对象
    if (m_iRef <= 0)
    {
        delete this;
    }
}
예제 #8
0
   void CheckDone()
   {
      if (mPlaying && (sDoneMusic || (sUsedMusic!=this)) )
      {
		 mLength = SDL_GetTicks () - mStartTime;
         mPlaying = false;
         if (sUsedMusic == this)
         {
            sUsedMusic = 0;
            sDoneMusic = false;
         }
         DecRef();
      }
   }
예제 #9
0
파일: scf.cpp 프로젝트: garinh/cs
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();
	}
}
예제 #11
0
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;
}
예제 #12
0
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;
}
예제 #13
0
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);
}
예제 #14
0
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();
}
예제 #15
0
//.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;
}
예제 #16
0
 ~JsonHandle()
 {
   DecRef();
 }
void OBSBasicStatusBar::RecordingStopped()
{
	recordOutput = nullptr;
	DecRef();
}
예제 #18
0
  /// Attach newly created object without incrementing ref count (it's already == 1).
  void AttachNew(json_struct_t * pJson)
  {
    DecRef();

    m_pJson = pJson;
  }