fix: prevent Widget.msg and EventHandler.msg from being corrupted by thespian.message.send
This commit is contained in:
		
							parent
							
								
									3e4a604739
								
							
						
					
					
						commit
						d6e9cec04d
					
				
					 2 changed files with 6 additions and 3 deletions
				
			
		|  | @ -108,7 +108,8 @@ pub fn dynamic_cast(self: Self, comptime T: type) ?*T { | |||
| } | ||||
| 
 | ||||
| pub fn msg(self: Self, m: anytype) tp.result { | ||||
|     return self.vtable.send(self.ptr, tp.self_pid(), tp.message.fmt(m)); | ||||
|     var buf: [tp.max_message_size]u8 = undefined; | ||||
|     return self.vtable.send(self.ptr, tp.self_pid(), tp.message.fmtbuf(&buf, m) catch |e| std.debug.panic("EventHandler.msg: {any}", .{e})); | ||||
| } | ||||
| 
 | ||||
| pub fn send(self: Self, from_: tp.pid_ref, m: tp.message) tp.result { | ||||
|  | @ -172,7 +173,8 @@ pub const List = struct { | |||
|     } | ||||
| 
 | ||||
|     pub fn msg(self: *const List, m: anytype) tp.result { | ||||
|         return self.send(tp.self_pid(), tp.message.fmt(m)); | ||||
|         var buf: [tp.max_message_size]u8 = undefined; | ||||
|         return self.send(tp.self_pid(), tp.message.fmtbuf(&buf, m) catch |e| std.debug.panic("EventHandler.List.msg: {any}", .{e})); | ||||
|     } | ||||
| 
 | ||||
|     pub fn send(self: *const List, from: tp.pid_ref, m: tp.message) tp.result { | ||||
|  |  | |||
|  | @ -178,7 +178,8 @@ pub fn deinit(self: Self, allocator: Allocator) void { | |||
| } | ||||
| 
 | ||||
| pub fn msg(self: *const Self, m: anytype) error{Exit}!bool { | ||||
|     return self.vtable.send(self.ptr, tp.self_pid(), tp.message.fmt(m)); | ||||
|     var buf: [tp.max_message_size]u8 = undefined; | ||||
|     return self.vtable.send(self.ptr, tp.self_pid(), tp.message.fmtbuf(&buf, m) catch |e| std.debug.panic("Widget.msg: {any}", .{e})); | ||||
| } | ||||
| 
 | ||||
| pub fn send(self: *const Self, from_: tp.pid_ref, m: tp.message) error{Exit}!bool { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue