Merge pull request #38 from linuxgurugamer/main

Nullref fix and memory leak fix
main
Andrew Cassidy 2 years ago committed by GitHub
commit 88b2b4841a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -8,6 +8,12 @@ All notable changes to this project will be documented in this file
| website | https://forum.kerbalspaceprogram.com/index.php?/topic/194802-18-111-conformal-decals |
| author | Andrew Cassidy |
## 0.2.11 - Unreleased, changes submitted by Linuxgurugamer
Fixed nullref caused when an entry in _targets was null
Fixed memory leak caused by the OnDestroy() methods not being called due to them being virtual
## 0.2.10 - 2022-03-14
### Fixed

@ -283,7 +283,7 @@ namespace ConformalDecals {
}
}
public virtual void OnDestroy() {
public void OnDestroy() {
// remove GameEvents
if (HighLogic.LoadedSceneIsEditor) {
GameEvents.onEditorPartEvent.Remove(OnEditorEvent);
@ -440,6 +440,7 @@ namespace ConformalDecals {
// update projection
foreach (var target in _targets) {
if (target != null)
target.Project(_orthoMatrix, decalProjectorTransform, _boundsRenderer.bounds, useBaseNormal);
}
}
@ -577,6 +578,7 @@ namespace ConformalDecals {
// render on each target object
foreach (var target in _targets) {
if (target != null)
target.Render(_decalMaterial, part.mpb, camera);
}
}

@ -48,13 +48,11 @@ namespace ConformalDecals {
UpdateFlag();
}
public override void OnDestroy() {
public void OnDestroy() {
if (HighLogic.LoadedSceneIsEditor) {
// Unregister flag change event
GameEvents.onMissionFlagSelect.Remove(OnEditorFlagSelected);
}
base.OnDestroy();
}
[KSPEvent(guiActive = false, guiActiveEditor = true, guiName = "#LOC_ConformalDecals_gui-select-flag")]

@ -220,15 +220,13 @@ namespace ConformalDecals {
}
}
public override void OnDestroy() {
public void OnDestroy() {
if (HighLogic.LoadedSceneIsGame && _currentText != null) TextRenderer.UnregisterText(_currentText);
// close all UIs
if (_textEntryController != null) _textEntryController.Close();
if (_fillColorPickerController != null) _fillColorPickerController.Close();
if (_outlineColorPickerController != null) _outlineColorPickerController.Close();
base.OnDestroy();
}
protected override void OnDetach() {

Loading…
Cancel
Save