mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Fixed crashes due to wrong use of append allocations
This commit is contained in:
@@ -20,13 +20,13 @@ namespace GlitchyEngine
|
|||||||
private bool _running = true;
|
private bool _running = true;
|
||||||
private bool _isMinimized = false;
|
private bool _isMinimized = false;
|
||||||
|
|
||||||
private append LayerStack _layerStack = .() ~ delete:append _;
|
private append LayerStack _layerStack = .();
|
||||||
|
|
||||||
#if IMGUI
|
#if IMGUI
|
||||||
private ImGuiLayer _imGuiLayer;
|
private ImGuiLayer _imGuiLayer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private append GameTime _gameTime = .() ~ delete:append _;
|
private append GameTime _gameTime = .();
|
||||||
|
|
||||||
private IContentManager _contentManager;
|
private IContentManager _contentManager;
|
||||||
|
|
||||||
@@ -98,6 +98,8 @@ namespace GlitchyEngine
|
|||||||
{
|
{
|
||||||
Profiler.ProfileFunction!();
|
Profiler.ProfileFunction!();
|
||||||
|
|
||||||
|
_layerStack.ClearLayers();
|
||||||
|
|
||||||
SamplerStateManager.Uninit();
|
SamplerStateManager.Uninit();
|
||||||
|
|
||||||
Renderer.Deinit();
|
Renderer.Deinit();
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace GlitchyEngine
|
|||||||
*/
|
*/
|
||||||
public class GameTime
|
public class GameTime
|
||||||
{
|
{
|
||||||
private append Stopwatch _stopwatch = .() ~ delete:append _;
|
private append Stopwatch _stopwatch = .();
|
||||||
|
|
||||||
private uint64 _frameCount;
|
private uint64 _frameCount;
|
||||||
|
|
||||||
|
|||||||
@@ -4,15 +4,22 @@ namespace GlitchyEngine
|
|||||||
{
|
{
|
||||||
public class LayerStack
|
public class LayerStack
|
||||||
{
|
{
|
||||||
private List<Layer> _layers = new List<Layer>() ~ delete _;
|
private append List<Layer> _layers = .();
|
||||||
|
|
||||||
public ~this()
|
public ~this()
|
||||||
|
{
|
||||||
|
ClearLayers();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearLayers()
|
||||||
{
|
{
|
||||||
for(let layer in _layers)
|
for(let layer in _layers)
|
||||||
{
|
{
|
||||||
layer.OnDetach();
|
layer.OnDetach();
|
||||||
delete layer;
|
delete layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_layers.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -16,18 +16,18 @@ class EngineClasses
|
|||||||
{
|
{
|
||||||
// TODO: Not all of these are actually ScriptClasses (actually none of them are...)
|
// TODO: Not all of these are actually ScriptClasses (actually none of them are...)
|
||||||
|
|
||||||
private ScriptClass s_ComponentRoot ~ _?.ReleaseRef();
|
private ScriptClass s_ComponentRoot;
|
||||||
private ScriptClass s_EntityRoot ~ _?.ReleaseRef();
|
private ScriptClass s_EntityRoot;
|
||||||
private ScriptClass s_EngineObject ~ _?.ReleaseRef();
|
private ScriptClass s_EngineObject;
|
||||||
|
|
||||||
private EntityEditorWrapper s_EntityEditor ~ _?.ReleaseRef();
|
private EntityEditorWrapper s_EntityEditor;
|
||||||
|
|
||||||
private EntitySerializerWrapper s_EntitySerializer ~ _?.ReleaseRef();
|
private EntitySerializerWrapper s_EntitySerializer;
|
||||||
private ScriptClass s_SerializationContext ~ _?.ReleaseRef();
|
private ScriptClass s_SerializationContext;
|
||||||
|
|
||||||
private ScriptClass s_Collision2D ~ _?.ReleaseRef();
|
private ScriptClass s_Collision2D;
|
||||||
|
|
||||||
private ScriptClass s_RunInEditModeAttribute ~ _?.ReleaseRef();
|
private ScriptClass s_RunInEditModeAttribute;
|
||||||
|
|
||||||
public ScriptClass ComponentRoot => s_ComponentRoot;
|
public ScriptClass ComponentRoot => s_ComponentRoot;
|
||||||
public ScriptClass EntityRoot => s_EntityRoot;
|
public ScriptClass EntityRoot => s_EntityRoot;
|
||||||
@@ -41,6 +41,11 @@ class EngineClasses
|
|||||||
|
|
||||||
public ScriptClass RunInEditModeAttribute => s_RunInEditModeAttribute;
|
public ScriptClass RunInEditModeAttribute => s_RunInEditModeAttribute;
|
||||||
|
|
||||||
|
public ~this()
|
||||||
|
{
|
||||||
|
ReleaseAndNullify();
|
||||||
|
}
|
||||||
|
|
||||||
internal void ReleaseAndNullify()
|
internal void ReleaseAndNullify()
|
||||||
{
|
{
|
||||||
ReleaseRefAndNullify!(s_EngineObject);
|
ReleaseRefAndNullify!(s_EngineObject);
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ public class ScriptInstanceSerializer
|
|||||||
public ~this()
|
public ~this()
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
delete:append _serializedData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
|
|||||||
Reference in New Issue
Block a user