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
Родитель 0ff6ac2cc0
Коммит 07f1042cd8
2 изменённых файлов: 56 добавлений и 0 удалений

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -154,6 +154,20 @@ private:
WINDOWPOS windowPos;
};
// This class duplicates a data buffer for a WM_COPYDATA message.
class DeferredCopyDataMessage : public DeferredSendMessage
{
public:
DeferredCopyDataMessage(HWND aHWnd,
UINT aMessage,
WPARAM aWParam,
LPARAM aLParam);
~DeferredCopyDataMessage();
private:
COPYDATASTRUCT copyData;
};
} /* namespace windows */
} /* namespace ipc */
} /* namespace mozilla */