From 517ae9d0ea44732e39af40c290c116aec99420cd Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 2 Aug 2013 19:48:45 +0000 Subject: mir_ptr<> shall be initialized by NULL by default git-svn-id: http://svn.miranda-ng.org/main/trunk@5554 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_system_cpp.h | 2 +- protocols/MRA/src/MraRTFMsg.cpp | 2 +- src/mir_core/modules.cpp | 28 ++++++++++++++-------------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/m_system_cpp.h b/include/m_system_cpp.h index 211d434da8..fb9edeb582 100644 --- a/include/m_system_cpp.h +++ b/include/m_system_cpp.h @@ -44,7 +44,7 @@ template class mir_ptr T* data; public: - __inline mir_ptr() : data((T*)mir_calloc(sizeof(T))) {} + __inline mir_ptr() : data(NULL) {} __inline mir_ptr(T* _p) : data(_p) {} __inline ~mir_ptr() { mir_free(data); } __inline T* operator = (T* _p) { if (data) mir_free(data); data = _p; return data; } diff --git a/protocols/MRA/src/MraRTFMsg.cpp b/protocols/MRA/src/MraRTFMsg.cpp index f69d080b26..fd7fa41bd9 100644 --- a/protocols/MRA/src/MraRTFMsg.cpp +++ b/protocols/MRA/src/MraRTFMsg.cpp @@ -202,7 +202,7 @@ DWORD CMraProto::MraConvertToRTFW(LPCWSTR lpwszMessage, size_t dwMessageSize, LP return ERROR_BUFFER_OVERFLOW; } - mir_ptr lpszMessage((LPSTR)mir_calloc(dwMessageSize+32)); + ptrA lpszMessage((LPSTR)mir_calloc(dwMessageSize+32)); if (!lpszMessage) return GetLastError(); diff --git a/src/mir_core/modules.cpp b/src/mir_core/modules.cpp index 853205ba01..bbbdfc2f61 100644 --- a/src/mir_core/modules.cpp +++ b/src/mir_core/modules.cpp @@ -262,13 +262,13 @@ MIR_CORE_DLL(int) NotifyEventHooks(HANDLE hEvent, WPARAM wParam, LPARAM lParam) if ( GetCurrentThreadId() == mainThreadId) return CallHookSubscribers((THook*)hEvent, wParam, lParam); - mir_ptr item; - item->hDoneEvent = getThreadEvent(); - item->hook = (THook*)hEvent; - item->wParam = wParam; - item->lParam = lParam; - QueueMainThread(HookToMainAPCFunc, item, item->hDoneEvent); - return item->result; + THookToMainThreadItem item; + item.hDoneEvent = getThreadEvent(); + item.hook = (THook*)hEvent; + item.wParam = wParam; + item.lParam = lParam; + QueueMainThread(HookToMainAPCFunc, &item, item.hDoneEvent); + return item.result; } MIR_CORE_DLL(int) NotifyFastHook(HANDLE hEvent, WPARAM wParam, LPARAM lParam) @@ -551,13 +551,13 @@ MIR_CORE_DLL(INT_PTR) CallServiceSync(const char *name, WPARAM wParam, LPARAM lP if (GetCurrentThreadId() == mainThreadId) return CallService(name, wParam, lParam); - mir_ptr item; - item->wParam = wParam; - item->lParam = lParam; - item->name = name; - item->hDoneEvent = getThreadEvent(); - QueueMainThread(CallServiceToMainAPCFunc, item, item->hDoneEvent); - return item->result; + TServiceToMainThreadItem item; + item.wParam = wParam; + item.lParam = lParam; + item.name = name; + item.hDoneEvent = getThreadEvent(); + QueueMainThread(CallServiceToMainAPCFunc, &item, item.hDoneEvent); + return item.result; } MIR_CORE_DLL(int) CallFunctionAsync(void (__stdcall *func)(void *), void *arg) -- cgit v1.2.3