Ticket #1454: patch4.diff

File patch4.diff, 1.7 KB (added by tropics, 20 years ago)

patch v1

  • ServerThread.cpp

     
    969969    LeaveCritSection(m_threadsync);
    970970}
    971971
    972 std::list<CServerThread::t_Notification> CServerThread::GetNotifications()
     972void CServerThread::GetNotifications(std::list<CServerThread::t_Notification>& list)
    973973{
    974974    EnterCritSection(m_threadsync);
    975975   
    976     std::list<t_Notification> list = m_pendingNotifications;
    977     m_pendingNotifications.clear();
     976    m_pendingNotifications.swap(list);
    978977
    979978    if (m_throttled)
    980979        SetPriority(THREAD_PRIORITY_NORMAL);
    981980
    982981    LeaveCritSection(m_threadsync);
    983 
    984     return list;
    985982}
    986983
    987984void CServerThread::AntiHammerIncrease(DWORD ip)
  • ServerThread.h

     
    6969    };
    7070
    7171    void SendNotification(WPARAM wParam, LPARAM lParam);
    72     std::list<t_Notification> GetNotifications();
     72    void GetNotifications(std::list<t_Notification>& list); // list MUST be empty when entering!
    7373
    7474    void AntiHammerIncrease(DWORD ip);
    7575   
  • Server.cpp

     
    213213        CServerThread *pThread = pServer->m_ThreadNotificationIDs[index];
    214214        if (pThread)
    215215        {
    216             std::list<CServerThread::t_Notification> notifications = pThread->GetNotifications();
     216            std::list<CServerThread::t_Notification> notifications;
     217            pThread->GetNotifications(notifications);
    217218            for (std::list<CServerThread::t_Notification>::const_iterator iter = notifications.begin(); iter != notifications.end(); iter++)
    218219                if (pServer->OnServerMessage(pThread, iter->wParam, iter->lParam) != 0)
    219220                    break;