Applied [ 872574 ] fix of fatal error of preview without printer

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@25090 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2004-01-08 08:29:59 +00:00
parent f530896a7a
commit b1781a3c47
2 changed files with 11 additions and 10 deletions

View File

@@ -920,8 +920,13 @@ void wxDocManager::OnPreview(wxCommandEvent& WXUNUSED(event))
if (printout)
{
// Pass two printout objects: for preview, and possible printing.
wxPrintPreviewBase *preview = (wxPrintPreviewBase *) NULL;
preview = new wxPrintPreview(printout, view->OnCreatePrintout());
wxPrintPreviewBase *preview = new wxPrintPreview(printout, view->OnCreatePrintout());
if ( !preview->Ok() )
{
delete preview;
wxMessageBox( _("Sorry, print preview needs a printer to be installed.") );
return;
}
wxPreviewFrame *frame = new wxPreviewFrame(preview, (wxFrame *)wxTheApp->GetTopWindow(), _("Print Preview"),
wxPoint(100, 100), wxSize(600, 650));

View File

@@ -383,14 +383,10 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
{
// Retrieve the default device name
wxString portName;
#ifdef __WXDEBUG__
bool ret =
#else // !Debug
(void)
#endif // Debug/Release
wxGetDefaultDeviceName(devNameStr, portName);
wxASSERT_MSG( ret, wxT("Could not get default device name.") );
if (!wxGetDefaultDeviceName(devNameStr, portName))
{
return 0; // Could not get default device name
}
deviceName = devNameStr.c_str();
}