mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 09:17:36 +13:00
Dispose Image only when not needed for preview
This commit is contained in:
parent
12d5010769
commit
7e7aeb44c2
1 changed files with 9 additions and 9 deletions
|
@ -304,14 +304,9 @@ private void ThreadDoWork()
|
|||
}
|
||||
finally
|
||||
{
|
||||
bool hasFile = !string.IsNullOrEmpty(Info.FilePath) && File.Exists(Info.FilePath);
|
||||
Dispose(!(Info.DataType == EDataType.Image && Info.TaskSettings.GeneralSettings.PopUpNotification == PopUpNotificationType.ToastNotification));
|
||||
|
||||
if (hasFile || Info.DataType != EDataType.Image)
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
if (Info.Job == TaskJob.Job && Info.TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.DeleteFile) && hasFile)
|
||||
if (Info.Job == TaskJob.Job && Info.TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.DeleteFile) && !string.IsNullOrEmpty(Info.FilePath) && File.Exists(Info.FilePath))
|
||||
{
|
||||
File.Delete(Info.FilePath);
|
||||
}
|
||||
|
@ -1117,7 +1112,7 @@ private void OnUploadersConfigWindowRequested(IUploaderService uploaderService)
|
|||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
private void Dispose(bool shouldDisposeImage)
|
||||
{
|
||||
if (Data != null)
|
||||
{
|
||||
|
@ -1125,11 +1120,16 @@ public void Dispose()
|
|||
Data = null;
|
||||
}
|
||||
|
||||
if (Image != null)
|
||||
if (Image != null && shouldDisposeImage)
|
||||
{
|
||||
Image.Dispose();
|
||||
Image = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue