From 7ea64f910b4ad6e3e4ab557a56ab85818db68eb3 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Mon, 13 Jan 2020 19:11:10 +0100 Subject: [PATCH] Fatal crash (Texture name input) #367 --- Source/Core/Data/DataManager.cs | 2 +- Source/Core/Data/UnknownImage.cs | 6 +++--- Source/Core/Editing/GridSetup.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Core/Data/DataManager.cs b/Source/Core/Data/DataManager.cs index f8fbae87..c6e69a24 100755 --- a/Source/Core/Data/DataManager.cs +++ b/Source/Core/Data/DataManager.cs @@ -230,7 +230,7 @@ namespace CodeImp.DoomBuilder.Data // Load special images (mxd: the rest is loaded in LoadInternalTextures()) whitetexture = new ResourceImage("CodeImp.DoomBuilder.Resources.White.png") { UseColorCorrection = false }; blacktexture = new ResourceImage("CodeImp.DoomBuilder.Resources.Black.png") { UseColorCorrection = false }; //mxd - unknownimage = new UnknownImage(Properties.Resources.UnknownImage); //mxd. There should be only one! + unknownimage = new UnknownImage(); //mxd. There should be only one! //mxd. Textures browser images foldertexture = new ResourceImage("CodeImp.DoomBuilder.Resources.Folder96.png") { UseColorCorrection = false }; diff --git a/Source/Core/Data/UnknownImage.cs b/Source/Core/Data/UnknownImage.cs index 6447fa41..ef652a43 100755 --- a/Source/Core/Data/UnknownImage.cs +++ b/Source/Core/Data/UnknownImage.cs @@ -34,12 +34,12 @@ namespace CodeImp.DoomBuilder.Data #region ================== Constructor / Disposer // Constructor - public UnknownImage(Bitmap image) + public UnknownImage() { // Initialize this.width = 0; this.height = 0; - this.loadbitmap = image; + this.loadbitmap = Properties.Resources.UnknownImage; SetName(""); LoadImageNow(); @@ -52,7 +52,7 @@ namespace CodeImp.DoomBuilder.Data // This 'loads' the image protected override LocalLoadResult LocalLoadImage() { - return new LocalLoadResult(loadbitmap); + return new LocalLoadResult(new Bitmap(loadbitmap)); } // This returns a preview image diff --git a/Source/Core/Editing/GridSetup.cs b/Source/Core/Editing/GridSetup.cs index 9e13350f..d8116905 100755 --- a/Source/Core/Editing/GridSetup.cs +++ b/Source/Core/Editing/GridSetup.cs @@ -55,7 +55,7 @@ namespace CodeImp.DoomBuilder.Editing // Background private string background = ""; private int backsource; - private ImageData backimage = new UnknownImage(null); + private ImageData backimage = new UnknownImage(); private int backoffsetx, backoffsety; private float backscalex, backscaley;