Bug 545760 - '[OOPP] Fix a few bad DefWindowProc messages that slipped through'. WM_SETICON. r=jimm.

This commit is contained in:
Ben Turner 2010-02-18 12:11:31 -08:00
Родитель ece57f08b7
Коммит 48038b40eb
2 изменённых файлов: 48 добавлений и 1 удалений

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

@ -288,13 +288,17 @@ ProcessOrDeferMessage(HWND hwnd,
break;
}
case WM_SETICON: {
deferred = new DeferredSetIconMessage(hwnd, uMsg, wParam, lParam);
break;
}
// Messages that are safe to pass to DefWindowProc go here.
case WM_ENTERIDLE:
case WM_GETICON:
case WM_GETMINMAXINFO:
case WM_GETTEXT:
case WM_NCHITTEST:
case WM_SETICON:
case WM_STYLECHANGING:
case WM_SYNCPAINT: // Intentional fall-through.
case WM_WINDOWPOSCHANGING: {
@ -1141,3 +1145,35 @@ DeferredStyleChangeMessage::Run()
{
SetWindowLongPtr(hWnd, index, style);
}
DeferredSetIconMessage::DeferredSetIconMessage(HWND aHWnd,
UINT aMessage,
WPARAM aWParam,
LPARAM aLParam)
: DeferredSendMessage(aHWnd, aMessage, aWParam, aLParam)
{
NS_ASSERTION(aMessage == WM_SETICON, "Wrong message type!");
}
void
DeferredSetIconMessage::Run()
{
AssertWindowIsNotNeutered(hWnd);
if (!IsWindow(hWnd)) {
NS_ERROR("Invalid window!");
return;
}
WNDPROC wndproc =
reinterpret_cast<WNDPROC>(GetWindowLongPtr(hWnd, GWLP_WNDPROC));
if (!wndproc) {
NS_ERROR("Invalid window procedure!");
return;
}
HICON hOld = reinterpret_cast<HICON>(
CallWindowProc(wndproc, hWnd, message, wParam, lParam));
if (hOld) {
DestroyIcon(hOld);
}
}

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

@ -183,6 +183,17 @@ private:
LONG_PTR style;
};
class DeferredSetIconMessage : public DeferredSendMessage
{
public:
DeferredSetIconMessage(HWND aHWnd,
UINT aMessage,
WPARAM aWParam,
LPARAM aLParam);
virtual void Run();
};
} /* namespace windows */
} /* namespace ipc */
} /* namespace mozilla */