Fixed UI thread becoming unresponsible in case of missing textures

This commit is contained in:
ZZYZX 2019-12-28 20:12:22 +02:00
parent 866facf80b
commit 78fe6c306e
4 changed files with 12 additions and 7 deletions

View file

@ -246,14 +246,19 @@ namespace CodeImp.DoomBuilder.Data
}
}
public void LoadImage()
{
LoadImage(true);
}
// This loads the image
public virtual void LoadImage()
public virtual void LoadImage(bool notify)
{
// Do the loading
LocalLoadImage();
// Notify the main thread about the change so that sectors can update their buffers
General.MainWindow.ImageDataLoaded(this.name);
if (notify) General.MainWindow.ImageDataLoaded(this.name);
}
// This requests loading the image

View file

@ -106,7 +106,7 @@ namespace CodeImp.DoomBuilder.Data
lock(img)
{
// Load image if needed
if(!img.IsImageLoaded) img.LoadImage();
if(!img.IsImageLoaded) img.LoadImage(false);
int imagewidth, imageheight;
Bitmap image = img.GetBitmap(); //mxd
Bitmap preview;

View file

@ -65,13 +65,13 @@ namespace CodeImp.DoomBuilder.Data
#region ================== Methods
//mxd
override public void LoadImage()
override public void LoadImage(bool notify)
{
// Do the loading
LocalLoadImage();
// Notify the main thread about the change to redraw display
General.MainWindow.SpriteDataLoaded(this.Name);
if (notify) General.MainWindow.SpriteDataLoaded(this.Name);
}
// This loads the image

View file

@ -53,13 +53,13 @@ namespace CodeImp.DoomBuilder.Data
#region ================== Methods
override public void LoadImage()
override public void LoadImage(bool notify)
{
// Do the loading
LocalLoadImage();
// Notify the main thread about the change to redraw display
General.MainWindow.SpriteDataLoaded(this.Name);
if (notify) General.MainWindow.SpriteDataLoaded(this.Name);
}
// This loads the image