Ignore:
Timestamp:
Dec 29, 1999, 3:37:19 PM (26 years ago)
Author:
sandervl
Message:

PostMessage memory leak fixed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/win32wbase.cpp

    r2246 r2250  
    1 /* $Id: win32wbase.cpp,v 1.123 1999-12-29 12:39:45 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.124 1999-12-29 14:37:17 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    923923//******************************************************************************
    924924//******************************************************************************
    925 ULONG Win32BaseWindow::DispatchMsg(MSG *msg)
     925ULONG Win32BaseWindow::DispatchMsgA(MSG *msg)
    926926{
    927927    return SendInternalMessageA(msg->message, msg->wParam, msg->lParam);
     928}
     929//******************************************************************************
     930//******************************************************************************
     931ULONG Win32BaseWindow::DispatchMsgW(MSG *msg)
     932{
     933    return SendInternalMessageW(msg->message, msg->wParam, msg->lParam);
    928934}
    929935//******************************************************************************
     
    18181824            Win32BaseWindow *window = GetTopParent();
    18191825            if(window && !(window->getClass()->getStyle() & CS_NOCLOSE))
    1820                 window->PostMessageA(WM_SYSCOMMAND, SC_CLOSE, 0);
     1826                PostMessageA(getWindowHandle(), WM_SYSCOMMAND, SC_CLOSE, 0);
    18211827        }
    18221828
     
    19771983LRESULT Win32BaseWindow::SendMessageA(ULONG Msg, WPARAM wParam, LPARAM lParam)
    19781984{
    1979  POSTMSG_PACKET *packet;
    1980 
    19811985    //if the destination window is created by this process & thread, call window proc directly
    19821986    if(dwProcessId == currentProcessId && dwThreadId == GetCurrentThreadId()) {
     
    19841988    }
    19851989    //otherwise use WinSendMsg to send it to the right process/thread
    1986     packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET));
    1987     packet->Msg = Msg;
    1988     packet->wParam = wParam;
    1989     packet->lParam = lParam;
    1990     packet->fUnicode = FALSE;
    1991     return OSLibSendMessage(getOS2WindowHandle(), WIN32APP_POSTMSG, WIN32PM_MAGIC, (DWORD)packet);
     1990    return OSLibSendMessage(getOS2WindowHandle(), Msg, wParam, lParam, FALSE);
    19921991}
    19931992//******************************************************************************
     
    19951994LRESULT Win32BaseWindow::SendMessageW(ULONG Msg, WPARAM wParam, LPARAM lParam)
    19961995{
    1997  POSTMSG_PACKET *packet;
    1998 
    19991996    //if the destination window is created by this process & thread, call window proc directly
    20001997    if(dwProcessId == currentProcessId && dwThreadId == GetCurrentThreadId()) {
     
    20021999    }
    20032000    //otherwise use WinSendMsg to send it to the right process/thread
    2004     packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET));
    2005     packet->Msg = Msg;
    2006     packet->wParam = wParam;
    2007     packet->lParam = lParam;
    2008     packet->fUnicode = TRUE;
    2009     return OSLibSendMessage(getOS2WindowHandle(), WIN32APP_POSTMSG, WIN32PM_MAGIC, (DWORD)packet);
     2001    return OSLibSendMessage(getOS2WindowHandle(), Msg, wParam, lParam, TRUE);
    20102002}
    20112003//******************************************************************************
     
    21272119//******************************************************************************
    21282120//******************************************************************************
    2129 BOOL Win32BaseWindow::PostMessageA(ULONG msg, WPARAM wParam, LPARAM lParam)
    2130 {
    2131  POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET));
    2132 
    2133     packet->Msg = msg;
    2134     packet->wParam = wParam;
    2135     packet->lParam = lParam;
    2136     packet->fUnicode = FALSE;
    2137     return OSLibPostMessage(OS2Hwnd, WIN32APP_POSTMSG, WIN32PM_MAGIC, (DWORD)packet);
    2138 }
    2139 //******************************************************************************
    2140 //******************************************************************************
    2141 BOOL Win32BaseWindow::PostMessageW(ULONG msg, WPARAM wParam, LPARAM lParam)
    2142 {
    2143  POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET));
    2144 
    2145     packet->Msg = msg;
    2146     packet->wParam = wParam;
    2147     packet->lParam = lParam;
    2148     packet->fUnicode = TRUE;
    2149     return OSLibPostMessage(OS2Hwnd, WIN32APP_POSTMSG, WIN32PM_MAGIC, (DWORD)packet);
    2150 }
    2151 //******************************************************************************
    2152 //******************************************************************************
    2153 BOOL Win32BaseWindow::PostThreadMessageA(ULONG threadid, UINT msg, WPARAM wParam, LPARAM lParam)
    2154 {
    2155  POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET));
    2156 
    2157     dprintf(("PostThreadMessageA %x %x %x %x", threadid, msg, wParam, lParam));
    2158     packet->Msg = msg;
    2159     packet->wParam = wParam;
    2160     packet->lParam = lParam;
    2161     packet->fUnicode = FALSE;
    2162     return OSLibPostThreadMessage(threadid, WIN32APP_POSTMSG, WIN32PM_MAGIC, (LPARAM)packet);
    2163 }
    2164 //******************************************************************************
    2165 //******************************************************************************
    2166 BOOL Win32BaseWindow::PostThreadMessageW(ULONG threadid, UINT msg, WPARAM wParam, LPARAM lParam)
    2167 {
    2168  POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET));
    2169 
    2170     dprintf(("PostThreadMessageW %x %x %x %x", threadid, msg, wParam, lParam));
    2171     packet->Msg = msg;
    2172     packet->wParam = wParam;
    2173     packet->lParam = lParam;
    2174     packet->fUnicode = TRUE;
    2175     return OSLibPostThreadMessage(threadid, WIN32APP_POSTMSG, WIN32PM_MAGIC, (LPARAM)packet);
    2176 }
    2177 //******************************************************************************
    2178 //******************************************************************************
    2179 ULONG Win32BaseWindow::PostMessage(POSTMSG_PACKET *packet)
    2180 {
    2181  ULONG rc;
    2182 
    2183     if(packet == NULL)
    2184         return 0;
    2185 
    2186     if(packet->fUnicode) {
    2187             rc = SendInternalMessageW(packet->Msg, packet->wParam, packet->lParam);
    2188     }
    2189     else    rc = SendInternalMessageA(packet->Msg, packet->wParam, packet->lParam);
    2190 
    2191     free(packet);
    2192     return rc;
    2193 }
    21942121//******************************************************************************
    21952122//TODO: Do this more efficiently
     
    22112138                        window->SendInternalMessageA(msg, wParam, lParam);
    22122139                }
    2213                 else    window->PostMessageA(msg, wParam, lParam);
     2140                else    PostMessageA(window->getWindowHandle(), msg, wParam, lParam);
    22142141            }
    22152142        }
     
    22242151 Win32BaseWindow *window;
    22252152 HWND hwnd = WNDHANDLE_MAGIC_HIGHWORD;
    2226 
    22272153
    22282154    dprintf(("BroadCastMessageW %x %x %x", msg, wParam, lParam));
     
    22372163                        window->SendInternalMessageW(msg, wParam, lParam);
    22382164                }
    2239                 else    window->PostMessageW(msg, wParam, lParam);
     2165                else    PostMessageW(window->getWindowHandle(), msg, wParam, lParam);
    22402166            }
    22412167        }
Note: See TracChangeset for help on using the changeset viewer.