handle matchbox panics (#1104)

This commit is contained in:
Logan McNaughton 2026-06-21 10:51:32 +02:00 committed by GitHub
parent d6aa2ddce3
commit 2dda5c8706
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 8 deletions

View File

@ -61,7 +61,6 @@ slint-build = { version = "1.12", optional = true }
cc = { version = "1.2", features = ["parallel"] }
[profile.release]
panic = "abort"
lto = "thin"
strip = true
@ -69,7 +68,6 @@ strip = true
inherits = "release"
debug = true
strip = false
panic = "unwind"
[package.metadata.bundle]
name = "Gopher64"

View File

@ -422,9 +422,7 @@ pub fn init(
eprintln!("Using default ICE config");
}
//matchbox seems to crash if you drop the socket right after closing it
//so I am storing them in a Vec so they aren't dropped until the function returns
let mut sockets = vec![create_socket(builder.clone())];
let mut socket = create_socket(builder.clone());
let mut now = std::time::Instant::now();
let mut message_timer = now;
@ -438,7 +436,6 @@ pub fn init(
device.cpu.running = true;
while device.cpu.running {
let socket = sockets.last_mut().unwrap();
socket.update_peers();
let peers = socket
.connected_peers()
@ -456,7 +453,7 @@ pub fn init(
} else if now.elapsed() > socket_timeout {
socket.close();
player_numbers.clear();
sockets.push(create_socket(builder.clone()));
socket = create_socket(builder.clone());
now = std::time::Instant::now();
}
@ -508,7 +505,6 @@ pub fn init(
}
}
let socket = sockets.last_mut().unwrap();
let matchbox_channel = MatchboxChannel {
channel: socket.take_channel(0).unwrap(),
};