summaryrefslogtreecommitdiff
path: root/protocols/MRA/src/MraAvatars.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-12-14 14:33:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-12-14 14:33:17 +0000
commit56ecec5734194ccf709c3f57fe1a15a1b926c68d (patch)
treece049dc932a37e32a1e8810a70562d2b0a32d9df /protocols/MRA/src/MraAvatars.cpp
parentffe922189b20daaf132ddfc24bfea9bf03a3a94b (diff)
let's operator new() clean the memory
git-svn-id: http://svn.miranda-ng.org/main/trunk@11406 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MRA/src/MraAvatars.cpp')
-rw-r--r--protocols/MRA/src/MraAvatars.cpp48
1 files changed, 21 insertions, 27 deletions
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp
index 2e757f7a66..2c709a8a3c 100644
--- a/protocols/MRA/src/MraAvatars.cpp
+++ b/protocols/MRA/src/MraAvatars.cpp
@@ -57,35 +57,30 @@ DWORD CMraProto::MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle)
return ERROR_INVALID_HANDLE;
MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = new MRA_AVATARS_QUEUE();
- if (pmraaqAvatarsQueue == NULL)
- return GetLastError();
- DWORD dwRetErrorCode = ListMTInitialize(pmraaqAvatarsQueue);
- if (dwRetErrorCode == NO_ERROR) {
- char szBuffer[MAX_PATH];
- mir_snprintf(szBuffer, SIZEOF(szBuffer), "%s %s", m_szModuleName, Translate("Avatars' plugin connections"));
-
- NETLIBUSER nlu = { sizeof(nlu) };
- nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS;
- nlu.szSettingsModule = MRA_AVT_SECT_NAME;
- nlu.szDescriptiveName = szBuffer;
- pmraaqAvatarsQueue->hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
- if (pmraaqAvatarsQueue->hNetlibUser) {
- InterlockedExchange((volatile LONG*)&pmraaqAvatarsQueue->bIsRunning, TRUE);
- pmraaqAvatarsQueue->hThreadEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- pmraaqAvatarsQueue->iThreadsCount = db_get_dw(NULL, MRA_AVT_SECT_NAME, "WorkThreadsCount", MRA_AVT_DEFAULT_WRK_THREAD_COUNTS);
- if (pmraaqAvatarsQueue->iThreadsCount == 0)
- pmraaqAvatarsQueue->iThreadsCount = 1;
- if (pmraaqAvatarsQueue->iThreadsCount > MAXIMUM_WAIT_OBJECTS)
- pmraaqAvatarsQueue->iThreadsCount = MAXIMUM_WAIT_OBJECTS;
- for (int i = 0; i < pmraaqAvatarsQueue->iThreadsCount; i++)
- pmraaqAvatarsQueue->hThread[i] = ForkThreadEx(&CMraProto::MraAvatarsThreadProc, pmraaqAvatarsQueue, 0);
-
- *phAvatarsQueueHandle = (HANDLE)pmraaqAvatarsQueue;
- }
+ char szBuffer[MAX_PATH];
+ mir_snprintf(szBuffer, SIZEOF(szBuffer), "%s %s", m_szModuleName, Translate("Avatars' plugin connections"));
+
+ NETLIBUSER nlu = { sizeof(nlu) };
+ nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS;
+ nlu.szSettingsModule = MRA_AVT_SECT_NAME;
+ nlu.szDescriptiveName = szBuffer;
+ pmraaqAvatarsQueue->hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ if (pmraaqAvatarsQueue->hNetlibUser) {
+ InterlockedExchange((volatile LONG*)&pmraaqAvatarsQueue->bIsRunning, TRUE);
+ pmraaqAvatarsQueue->hThreadEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ pmraaqAvatarsQueue->iThreadsCount = db_get_dw(NULL, MRA_AVT_SECT_NAME, "WorkThreadsCount", MRA_AVT_DEFAULT_WRK_THREAD_COUNTS);
+ if (pmraaqAvatarsQueue->iThreadsCount == 0)
+ pmraaqAvatarsQueue->iThreadsCount = 1;
+ if (pmraaqAvatarsQueue->iThreadsCount > MAXIMUM_WAIT_OBJECTS)
+ pmraaqAvatarsQueue->iThreadsCount = MAXIMUM_WAIT_OBJECTS;
+ for (int i = 0; i < pmraaqAvatarsQueue->iThreadsCount; i++)
+ pmraaqAvatarsQueue->hThread[i] = ForkThreadEx(&CMraProto::MraAvatarsThreadProc, pmraaqAvatarsQueue, 0);
+
+ *phAvatarsQueueHandle = (HANDLE)pmraaqAvatarsQueue;
}
- return dwRetErrorCode;
+ return NO_ERROR;
}
void CMraProto::MraAvatarsQueueClear(HANDLE hAvatarsQueueHandle)
@@ -129,7 +124,6 @@ void CMraProto::MraAvatarsQueueDestroy(HANDLE hAvatarsQueueHandle)
MraAvatarsQueueClear(hAvatarsQueueHandle);
- ListMTDestroy(pmraaqAvatarsQueue);
Netlib_CloseHandle(pmraaqAvatarsQueue->hNetlibUser);
delete pmraaqAvatarsQueue;
}