mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 02:37:03 -07:00
Removed surface disposing, and making sure the PrintHelper itself is disposed correctly. Disposing the surface is not allowed in a destination, e.g. this would rip the surface away right from under the editor :)
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2503 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
d1e3560f9c
commit
0e86fa409c
2 changed files with 90 additions and 92 deletions
|
@ -106,15 +106,21 @@ namespace Greenshot.Destinations {
|
|||
/// <param name="captureDetails"></param>
|
||||
/// <returns>ExportInformation</returns>
|
||||
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
|
||||
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
|
||||
PrinterSettings printerSettings = null;
|
||||
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
|
||||
PrinterSettings printerSettings = null;
|
||||
if (!string.IsNullOrEmpty(printerName)) {
|
||||
printerSettings = new PrintHelper(surface, captureDetails).PrintTo(printerName);
|
||||
using (PrintHelper printHelper = new PrintHelper(surface, captureDetails)) {
|
||||
printerSettings = printHelper.PrintTo(printerName);
|
||||
}
|
||||
} else if (!manuallyInitiated) {
|
||||
PrinterSettings settings = new PrinterSettings();
|
||||
printerSettings = new PrintHelper(surface, captureDetails).PrintTo(settings.PrinterName);
|
||||
using (PrintHelper printHelper = new PrintHelper(surface, captureDetails)) {
|
||||
printerSettings = printHelper.PrintTo(settings.PrinterName);
|
||||
}
|
||||
} else {
|
||||
printerSettings = new PrintHelper(surface, captureDetails).PrintWithDialog();
|
||||
using (PrintHelper printHelper = new PrintHelper(surface, captureDetails)) {
|
||||
printerSettings = printHelper.PrintWithDialog();
|
||||
}
|
||||
}
|
||||
if (printerSettings != null) {
|
||||
exportInformation.ExportMade = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue