fix Windows out-of-memory dialog
svn: r12375
This commit is contained in:
parent
9a1916e03e
commit
a452fa0cef
|
@ -3153,7 +3153,8 @@ static void MrEdOutOfMemory(void)
|
|||
#ifdef wx_mac
|
||||
Alert(101, NULL);
|
||||
#endif
|
||||
#ifdef wx_win
|
||||
#ifdef wx_msw
|
||||
wxNoMoreCallbacks();
|
||||
MessageBox(NULL,
|
||||
"PLT Scheme virtual machine is out of memory. Aborting.",
|
||||
"Out of Memory",
|
||||
|
|
|
@ -135,4 +135,6 @@ extern wxKeyEvent *wxMakeCharEvent(BOOL just_check, WORD wParam, LPARAM lParam,
|
|||
|
||||
extern BOOL wxTranslateMessage(MSG *m);
|
||||
|
||||
extern void wxNoMoreCallbacks(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -41,6 +41,8 @@ char wxCanvasClassName[] = "wxCanvasClass";
|
|||
|
||||
HICON wxSTD_FRAME_ICON = NULL;
|
||||
|
||||
DWORD wx_original_thread_id;
|
||||
|
||||
HFONT wxSTATUS_LINE_FONT = NULL;
|
||||
LRESULT APIENTRY wxWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
|
@ -102,6 +104,8 @@ void wxInitialize(HINSTANCE hInstance)
|
|||
if (!gaugeInit(hInstance))
|
||||
wxFatalError("Cannot initalize Gauge library");
|
||||
|
||||
wx_original_thread_id = GetCurrentThreadId();
|
||||
|
||||
wxSTD_FRAME_ICON = LoadIcon(hInstance, "wxSTD_FRAME");
|
||||
|
||||
{
|
||||
|
|
|
@ -1264,14 +1264,37 @@ static LONG WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, in
|
|||
return retval;
|
||||
}
|
||||
|
||||
|
||||
extern DWORD wx_original_thread_id;
|
||||
static int cut_off_callbacks;
|
||||
|
||||
void wxNoMoreCallbacks(void)
|
||||
{
|
||||
cut_off_callbacks = 1;
|
||||
}
|
||||
|
||||
static int invalid_callback_context()
|
||||
{
|
||||
if (GetCurrentThreadId() != wx_original_thread_id) {
|
||||
return 1;
|
||||
}
|
||||
if (cut_off_callbacks)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int wx_trampolining;
|
||||
|
||||
// Main window proc
|
||||
LRESULT APIENTRY wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
{
|
||||
LRESULT res;
|
||||
int tramp = wx_trampolining;
|
||||
|
||||
if (invalid_callback_context())
|
||||
return ::DefWindowProcW(hWnd, message, wParam, lParam);
|
||||
|
||||
wx_trampolining = 0;
|
||||
|
||||
/* WM_NCHITTEST is extremely common, and we do nothing with it.
|
||||
|
@ -1300,6 +1323,9 @@ LONG APIENTRY wxDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
LRESULT res;
|
||||
int tramp = wx_trampolining;
|
||||
|
||||
if (invalid_callback_context())
|
||||
return ::DefWindowProcW(hWnd, message, wParam, lParam);
|
||||
|
||||
wx_trampolining = 0;
|
||||
|
||||
/* See mredmsw.cxx: */
|
||||
|
|
Loading…
Reference in New Issue
Block a user