Bug 542821 - 'Process startup event gets dropped on the floor by deferred messaging'. r=jimm.

This commit is contained in:
Ben Turner
2010-02-03 13:09:55 -08:00
parent 821dab3153
commit f5d5d180fe
2 changed files with 56 additions and 0 deletions

View File

@@ -245,6 +245,12 @@ ProcessOrDeferMessage(HWND hwnd,
break;
}
case WM_COPYDATA: {
deferred = new DeferredCopyDataMessage(hwnd, uMsg, wParam, lParam);
res = TRUE;
break;
}
// Messages that are safe to pass to DefWindowProc go here.
case WM_GETICON:
case WM_GETMINMAXINFO:
@@ -725,3 +731,39 @@ DeferredWindowPosMessage::Run()
windowPos.y, windowPos.cx, windowPos.cy, windowPos.flags);
NS_ASSERTION(ret, "SetWindowPos failed!");
}
DeferredCopyDataMessage::DeferredCopyDataMessage(HWND aHWnd,
UINT aMessage,
WPARAM aWParam,
LPARAM aLParam)
: DeferredSendMessage(aHWnd, aMessage, aWParam, aLParam)
{
NS_ASSERTION(IsWindow(reinterpret_cast<HWND>(aWParam)), "Bad window!");
COPYDATASTRUCT* source = reinterpret_cast<COPYDATASTRUCT*>(aLParam);
NS_ASSERTION(source, "Should never be null!");
copyData.dwData = source->dwData;
copyData.cbData = source->cbData;
if (source->cbData) {
copyData.lpData = malloc(source->cbData);
if (copyData.lpData) {
memcpy(copyData.lpData, source->lpData, source->cbData);
}
else {
NS_ERROR("Out of memory?!");
copyData.cbData = 0;
}
}
else {
copyData.lpData = NULL;
}
lParam = reinterpret_cast<LPARAM>(&copyData);
}
DeferredCopyDataMessage::~DeferredCopyDataMessage()
{
free(copyData.lpData);
}