-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix leak when disposing query builder, move free logic to context str…
…ucts
- Loading branch information
1 parent
91fbb01
commit 19c3324
Showing
17 changed files
with
293 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace Flecs.NET.Codegen.Helpers; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,28 @@ | ||
using System; | ||
using Flecs.NET.Utilities; | ||
|
||
namespace Flecs.NET.Core.BindingContext; | ||
|
||
internal struct IteratorContext : IDisposable | ||
internal unsafe struct IteratorContext : IDisposable | ||
{ | ||
public Callback Callback; | ||
|
||
public void Dispose() | ||
{ | ||
Callback.Dispose(); | ||
} | ||
|
||
public static void Free(IteratorContext* context) | ||
{ | ||
if (context == null) | ||
return; | ||
context->Dispose(); | ||
Memory.Free(context); | ||
} | ||
|
||
public static void Free(ref IteratorContext context) | ||
{ | ||
fixed (IteratorContext* ptr = &context) | ||
Free(ptr); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using Flecs.NET.Utilities; | ||
|
||
namespace Flecs.NET.Core.BindingContext; | ||
|
||
internal unsafe struct ObserverContext : IDisposable | ||
{ | ||
public UserContext UserContext; | ||
|
||
public void Dispose() | ||
{ | ||
UserContext.Dispose(); | ||
} | ||
|
||
public static void Free(ObserverContext* context) | ||
{ | ||
if (context == null) | ||
return; | ||
context->Dispose(); | ||
Memory.Free(context); | ||
} | ||
|
||
public static void Free(ref ObserverContext context) | ||
{ | ||
fixed (ObserverContext* ptr = &context) | ||
Free(ptr); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,28 @@ | ||
using System; | ||
using Flecs.NET.Utilities; | ||
|
||
namespace Flecs.NET.Core.BindingContext; | ||
|
||
internal struct PostFrameContext : IDisposable | ||
internal unsafe struct PostFrameContext : IDisposable | ||
{ | ||
public Callback Callback; | ||
|
||
public void Dispose() | ||
{ | ||
Callback.Dispose(); | ||
} | ||
|
||
public static void Free(PostFrameContext* context) | ||
{ | ||
if (context == null) | ||
return; | ||
context->Dispose(); | ||
Memory.Free(context); | ||
} | ||
|
||
public static void Free(ref PostFrameContext context) | ||
{ | ||
fixed (PostFrameContext* ptr = &context) | ||
Free(ptr); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,28 @@ | ||
using System; | ||
using Flecs.NET.Utilities; | ||
|
||
namespace Flecs.NET.Core.BindingContext; | ||
|
||
internal struct RunContext : IDisposable | ||
internal unsafe struct RunContext : IDisposable | ||
{ | ||
public Callback Callback; | ||
|
||
public void Dispose() | ||
{ | ||
Callback.Dispose(); | ||
} | ||
|
||
public static void Free(RunContext* context) | ||
{ | ||
if (context == null) | ||
return; | ||
context->Dispose(); | ||
Memory.Free(context); | ||
} | ||
|
||
public static void Free(ref RunContext context) | ||
{ | ||
fixed (RunContext* ptr = &context) | ||
Free(ptr); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using Flecs.NET.Utilities; | ||
|
||
namespace Flecs.NET.Core.BindingContext; | ||
|
||
internal unsafe struct SystemContext : IDisposable | ||
{ | ||
public UserContext UserContext; | ||
|
||
public void Dispose() | ||
{ | ||
UserContext.Dispose(); | ||
} | ||
|
||
public static void Free(SystemContext* context) | ||
{ | ||
if (context == null) | ||
return; | ||
context->Dispose(); | ||
Memory.Free(context); | ||
} | ||
|
||
public static void Free(ref SystemContext context) | ||
{ | ||
fixed (SystemContext* ptr = &context) | ||
Free(ptr); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,28 @@ | ||
using System; | ||
using Flecs.NET.Utilities; | ||
|
||
namespace Flecs.NET.Core.BindingContext; | ||
|
||
internal struct WorldFinishContext : IDisposable | ||
internal unsafe struct WorldFinishContext : IDisposable | ||
{ | ||
public Callback Callback; | ||
|
||
public void Dispose() | ||
{ | ||
Callback.Dispose(); | ||
} | ||
|
||
public static void Free(WorldFinishContext* context) | ||
{ | ||
if (context == null) | ||
return; | ||
context->Dispose(); | ||
Memory.Free(context); | ||
} | ||
|
||
public static void Free(ref WorldFinishContext context) | ||
{ | ||
fixed (WorldFinishContext* ptr = &context) | ||
Free(ptr); | ||
} | ||
} |
Oops, something went wrong.