Skip to content
Snippets Groups Projects
Commit c95e5af4 authored by Magnus Norddahl's avatar Magnus Norddahl
Browse files

Reduce memory usage during preview image loading

parent 65fdafaf
No related branches found
No related tags found
No related merge requests found
......@@ -228,9 +228,17 @@ namespace CodeImp.DoomBuilder.Data
ConvertImageFormat(loadResult);
MakeImagePreview(loadResult);
// Save memory by disposing the original image immediately if we only used it to load a preview image
bool onlyPreview = false;
if (imagestate == ImageLoadState.Ready)
{
loadResult.bitmap?.Dispose();
onlyPreview = true;
}
General.MainWindow.RunOnUIThread(() =>
{
if (imagestate != ImageLoadState.Ready)
if (imagestate != ImageLoadState.Ready && !onlyPreview)
{
// Log errors and warnings
foreach (LogMessage message in loadResult.messages)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment