fix: improper lifetime for *Arm7tdmi ptr in Bus

*Arm7tdmi ptr is now assigned one scope up so that it lives as least
as long as Bus does
This commit is contained in:
2022-04-21 07:56:17 -03:00
parent 85e8ca9146
commit 75ba9a4bf9
3 changed files with 7 additions and 3 deletions

View File

@@ -80,7 +80,7 @@ pub const Arm7tdmi = struct {
binary_log: bool,
pub fn init(alloc: Allocator, sched: *Scheduler, paths: FilePaths) !Self {
var cpu: Arm7tdmi = .{
return Self{
.r = [_]u32{0x00} ** 16,
.sched = sched,
.bus = try Bus.init(alloc, sched, paths),
@@ -93,8 +93,6 @@ pub const Arm7tdmi = struct {
.log_buf = undefined,
.binary_log = false,
};
cpu.bus.cpu = &cpu;
return cpu;
}
pub fn deinit(self: Self) void {