chore: cleanup

This commit is contained in:
2025-05-26 17:47:46 +02:00
parent 095b8659d6
commit 726908bfbe

View File

@@ -195,15 +195,11 @@ const Model = struct {
const children = try ctx.arena.create(std.ArrayList(*vxfw.Text)); const children = try ctx.arena.create(std.ArrayList(*vxfw.Text));
children.* = std.ArrayList(*vxfw.Text).init(ctx.arena); children.* = std.ArrayList(*vxfw.Text).init(ctx.arena);
// const current_index = vm.current_items_view.cursor;
// const children = try ctx.arena.alloc(*vxfw.Text, items.len);
for (items.items) |*original_arc_child| { for (items.items) |*original_arc_child| {
const arc_child = original_arc_child.retain(); const arc_child = original_arc_child.retain();
defer if (arc_child.releaseUnwrap()) |item| item.deinit(); defer if (arc_child.releaseUnwrap()) |item| item.deinit();
const child = arc_child.value.*; const child = arc_child.value.*;
// const is_active = i == current_index;
const is_active = if (current_full_name) |c_full_name| const is_active = if (current_full_name) |c_full_name|
models.FullName.eql(&c_full_name, &child.fullName) models.FullName.eql(&c_full_name, &child.fullName)
else else
@@ -271,31 +267,9 @@ pub fn main() !void {
_ = gpa.deinit(); _ = gpa.deinit();
} }
// const type2 = struct {
// allocator: *DebugAllocator,
//
// pub fn deinit(obj: *anyopaque) void {
// const self: *@This() = @ptrCast(@alignCast(obj));
// _ = DebugAllocator.deinit(self.allocator);
// }
// };
// var asd2: type2 = .{
// .allocator = &gpa,
// };
// const callback = asd1.Callback.create(&asd2);
//
// callback.call();
var tsa = std.heap.ThreadSafeAllocator{ .child_allocator = gp_allocator }; var tsa = std.heap.ThreadSafeAllocator{ .child_allocator = gp_allocator };
const allocator = tsa.allocator(); const allocator = tsa.allocator();
// const args = .{gpa};
// const type1 = asd1.makeCallbackType(DebugAllocator.deinit, @TypeOf(args));
// const instance1 = type1.init(args);
// // _ = instance1;
// const callback = instance1.makeCallback();
// _ = callback;
var pool: std.Thread.Pool = undefined; var pool: std.Thread.Pool = undefined;
try pool.init(.{ try pool.init(.{
.allocator = allocator, .allocator = allocator,
@@ -329,12 +303,6 @@ pub fn main() !void {
defer allocator.destroy(empty_text_element); defer allocator.destroy(empty_text_element);
empty_text_element.* = vxfw.Text{ empty_text_element.* = vxfw.Text{
.text = "Empty", .text = "Empty",
// .overflow = .clip,
// .softwrap = false,
// .style = .{
// .bg = bg,
// .fg = fg,
// },
}; };
const items = try allocator.alloc(vxfw.Widget, 1); const items = try allocator.alloc(vxfw.Widget, 1);
@@ -375,7 +343,6 @@ pub fn main() !void {
defer app.deinit(); defer app.deinit();
try app.run(model.widget(), .{}); try app.run(model.widget(), .{});
// std.Thread.sleep(10 * std.time.ns_per_s);
model.app_common_model.usage_number.data -= 1; model.app_common_model.usage_number.data -= 1;
model.app_common_model.running = false; model.app_common_model.running = false;