core: darwin: fix use-after-free
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
9032a22064
commit
3bb7833e38
1 changed files with 8 additions and 5 deletions
|
|
@ -130,11 +130,14 @@ fn initWindow(
|
||||||
var view = objc.mach.View.allocInit();
|
var view = objc.mach.View.allocInit();
|
||||||
view.setLayer(@ptrCast(layer));
|
view.setLayer(@ptrCast(layer));
|
||||||
|
|
||||||
var context: Context = .{ .core = core, .window_id = window_id };
|
const context = try core.allocator.create(Context);
|
||||||
|
context.* = .{ .core = core, .window_id = window_id };
|
||||||
|
// TODO(core): free this allocation
|
||||||
|
|
||||||
{
|
{
|
||||||
var keyDown = objc.foundation.stackBlockLiteral(
|
var keyDown = objc.foundation.stackBlockLiteral(
|
||||||
ViewCallbacks.keyDown,
|
ViewCallbacks.keyDown,
|
||||||
&context,
|
context,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
|
|
@ -142,7 +145,7 @@ fn initWindow(
|
||||||
|
|
||||||
var keyUp = objc.foundation.stackBlockLiteral(
|
var keyUp = objc.foundation.stackBlockLiteral(
|
||||||
ViewCallbacks.keyUp,
|
ViewCallbacks.keyUp,
|
||||||
&context,
|
context,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
|
|
@ -159,7 +162,7 @@ fn initWindow(
|
||||||
|
|
||||||
var windowWillResize_toSize = objc.foundation.stackBlockLiteral(
|
var windowWillResize_toSize = objc.foundation.stackBlockLiteral(
|
||||||
WindowDelegateCallbacks.windowWillResize_toSize,
|
WindowDelegateCallbacks.windowWillResize_toSize,
|
||||||
&context,
|
context,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
|
|
@ -167,7 +170,7 @@ fn initWindow(
|
||||||
|
|
||||||
var windowShouldClose = objc.foundation.stackBlockLiteral(
|
var windowShouldClose = objc.foundation.stackBlockLiteral(
|
||||||
WindowDelegateCallbacks.windowShouldClose,
|
WindowDelegateCallbacks.windowShouldClose,
|
||||||
&context,
|
context,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue