Ensure we don't crash when checking for cancelling print job
Don't dereference sm_abortWindow without checking that it is non-null in wxAbortProc(): even though it's not supposed to happen, it still somehow does, apparently, so just log a debug message instead of crashing in this case. See #23927. (cherry picked from commit 9a728192c4340b34d2509898f7f16b767a794ac9)
This commit is contained in:
parent
0efe1b7c29
commit
8de60c856f
@ -324,6 +324,7 @@ wxMSW:
|
||||
- Fix wrong wxWindowsPrintNativeData initialization (Stefan Ziegler, #23685).
|
||||
- Fix position of wxStaticBox label after DPI change (Maarten Bent, #23740).
|
||||
- Fix background colour of empty cells in wxDataViewCtrl (#23708).
|
||||
- Fix possible (even if rare) crash in printer progress dialog (#23927).
|
||||
|
||||
wxOSX:
|
||||
|
||||
|
@ -425,12 +425,24 @@ BOOL CALLBACK wxAbortProc(HDC WXUNUSED(hdc), int WXUNUSED(error))
|
||||
return(TRUE);
|
||||
|
||||
/* Process messages intended for the abort dialog box */
|
||||
const HWND hwnd = GetHwndOf(wxPrinterBase::sm_abortWindow);
|
||||
|
||||
while (!wxPrinterBase::sm_abortIt && ::PeekMessage(&msg, 0, 0, 0, TRUE))
|
||||
if (!IsDialogMessage((HWND) wxPrinterBase::sm_abortWindow->GetHWND(), &msg)) {
|
||||
{
|
||||
// Apparently handling the message may, somehow, result in
|
||||
// sm_abortWindow being destroyed, so guard against this happening.
|
||||
if (!wxPrinterBase::sm_abortWindow)
|
||||
{
|
||||
wxLogDebug(wxS("Print abort dialog unexpected disappeared."));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!IsDialogMessage(hwnd, &msg))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
/* bAbort is TRUE (return is FALSE) if the user has aborted */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user