Fix crash in GC titles when right-clicking island acres
This commit is contained in:
parent
6964903198
commit
dae486c60d
4 changed files with 41 additions and 5 deletions
|
@ -125,6 +125,8 @@
|
|||
</Compile>
|
||||
<Compile Include="ItemColorSettings.Designer.cs">
|
||||
<DependentUpon>ItemColorSettings.settings</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="SecureValueForm\SecureValueForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
|
@ -1411,6 +1413,9 @@
|
|||
<Content Include="Resources\DBNM_Plus_Items_en.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\DNM_Acres_en.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\DnM_Items_en.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
|
4
ACSE.WinForms/ItemColorSettings.Designer.cs
generated
4
ACSE.WinForms/ItemColorSettings.Designer.cs
generated
|
@ -8,11 +8,11 @@
|
|||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ACSE {
|
||||
namespace ACSE.WinForms {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")]
|
||||
internal sealed partial class ItemColorSettings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static ItemColorSettings defaultInstance = ((ItemColorSettings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new ItemColorSettings())));
|
||||
|
|
|
@ -3196,9 +3196,16 @@ private void AcreClick(object sender, MouseEventArgs e, bool island = false)
|
|||
}
|
||||
else
|
||||
{
|
||||
var boxes = island ? (IList<PictureBoxWithInterpolationMode>) _islandItemEditors : _acreMap;
|
||||
AcreImageManager.CheckReferencesAndDispose(oldImage, boxes,
|
||||
_selectedAcrePicturebox);
|
||||
if (island)
|
||||
{
|
||||
AcreImageManager.CheckReferencesAndDispose(oldImage, _islandItemEditors,
|
||||
_selectedAcrePicturebox);
|
||||
}
|
||||
else
|
||||
{
|
||||
AcreImageManager.CheckReferencesAndDispose(oldImage, _acreMap,
|
||||
_selectedAcrePicturebox);
|
||||
}
|
||||
}
|
||||
|
||||
_selectedAcreId = island ? IslandAcres[acreIndex].AcreId : _acres[acreIndex].AcreId;
|
||||
|
|
|
@ -160,6 +160,30 @@ public static void CheckReferencesAndDispose(Image referencedImage,
|
|||
referencedImage.Dispose();
|
||||
}
|
||||
|
||||
public static void CheckReferencesAndDispose(Image referencedImage,
|
||||
IList<AcreItemEditor> itemEditors, PictureBoxWithInterpolationMode selectedAcreBox)
|
||||
{
|
||||
if (referencedImage == null || selectedAcreBox.Image == referencedImage
|
||||
|| itemEditors.Any(
|
||||
box => box != null && box.BackgroundImage == referencedImage)) return;
|
||||
|
||||
foreach (var pair in _loadedImageDictionary)
|
||||
if (pair.Value == referencedImage)
|
||||
{
|
||||
_loadedImageDictionary.Remove(pair.Key);
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (var pair in _loadedAnimalCrossingMapIcons)
|
||||
if (pair.Value == referencedImage)
|
||||
{
|
||||
_loadedAnimalCrossingMapIcons.Remove(pair.Key);
|
||||
break;
|
||||
}
|
||||
|
||||
referencedImage.Dispose();
|
||||
}
|
||||
|
||||
public static void DisposeLoadedImages()
|
||||
{
|
||||
foreach (var i in _loadedImageDictionary.Values)
|
||||
|
|
Loading…
Reference in a new issue