Delete temporary device context used in wxGtkPrinter
Lifetime of wxPrinterDC created in BeginPrint() handler (associated with "begin-print" signal) is limited to the current print job and therefore this object should be destroyed when the actual printing is finished. See #14233.
This commit is contained in:
@@ -965,6 +965,7 @@ bool wxGtkPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt )
|
|||||||
dataToSend.printer = this;
|
dataToSend.printer = this;
|
||||||
dataToSend.printout = printout;
|
dataToSend.printout = printout;
|
||||||
|
|
||||||
|
wxDELETE(m_dc);
|
||||||
// These Gtk signals are caught here.
|
// These Gtk signals are caught here.
|
||||||
g_signal_connect (printOp, "begin-print", G_CALLBACK (gtk_begin_print_callback), &dataToSend);
|
g_signal_connect (printOp, "begin-print", G_CALLBACK (gtk_begin_print_callback), &dataToSend);
|
||||||
g_signal_connect (printOp, "draw-page", G_CALLBACK (gtk_draw_page_print_callback), &dataToSend);
|
g_signal_connect (printOp, "draw-page", G_CALLBACK (gtk_draw_page_print_callback), &dataToSend);
|
||||||
@@ -985,6 +986,9 @@ bool wxGtkPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt )
|
|||||||
sm_lastError = wxPRINTER_ERROR;
|
sm_lastError = wxPRINTER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printout->SetDC(NULL);
|
||||||
|
wxDELETE(m_dc);
|
||||||
|
|
||||||
return (sm_lastError == wxPRINTER_NO_ERROR);
|
return (sm_lastError == wxPRINTER_NO_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user