]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/printmac.cpp
fix a crash when dismissing the popup window because of a key press
[wxWidgets.git] / src / mac / carbon / printmac.cpp
index 08a6bf77adc5cff8fed862dd499249361a3e0c25..33506c4548f02f6ddc0a364edcbb096cb5feedae 100644 (file)
@@ -29,6 +29,8 @@
 #include "wx/msgdlg.h"
 #endif
 
+#include "wx/mac/private.h"
+
 #include "wx/mac/printmac.h"
 #include "wx/dcprint.h"
 #include "wx/printdlg.h"
@@ -136,7 +138,6 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
   // Create an abort window
   wxBeginBusyCursor();
 
-/*
   wxWindow *win = CreateAbortWindow(parent, printout);
   wxYield();
 
@@ -145,11 +146,11 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
     wxEndBusyCursor();
     wxMessageBox("Sorry, could not create an abort dialog.", "Print Error", wxOK, parent);
     delete dc;
+    return FALSE;
   }
   sm_abortWindow = win;
   sm_abortWindow->Show(TRUE);
   wxYield();
-*/
 
   printout->OnBeginPrinting();
   
@@ -178,6 +179,11 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
       }
       else
       {
+               GrafPtr thePort ;
+               GetPort( &thePort ) ;
+               wxYield() ;
+               SetPort( thePort ) ;
+
         dc->StartPage();
         keepGoing = printout->OnPrintPage(pn);
         dc->EndPage();