@@ -9684,7 +9684,11 @@ static inline void handle_dev_destroy_primary_surface(RedWorker *worker)
receive_data(worker->channel, &surface_id, sizeof(uint32_t));
PANIC_ON(surface_id != 0);
- PANIC_ON(!worker->surfaces[surface_id].context.canvas);
+
+ if (!worker->surfaces[surface_id].context.canvas) {
+ red_printf("warning: double destroy of primary surface\n");
+ goto end;
+ }
if (worker->cursor) {
red_release_cursor(worker, worker->cursor);
@@ -9711,6 +9715,7 @@ static inline void handle_dev_destroy_primary_surface(RedWorker *worker)
worker->cursor_position.x = worker->cursor_position.y = 0;
worker->cursor_trail_length = worker->cursor_trail_frequency = 0;
+end:
message = RED_WORKER_MESSAGE_READY;
write_message(worker->channel, &message);
}