fix(native): harden player teardown and shelf recovery

This commit is contained in:
edde746
2026-07-25 16:16:24 +02:00
parent 4af77f4696
commit f8f366a513
26 changed files with 2895 additions and 302 deletions
+1 -1
View File
@@ -560,7 +560,7 @@ void MpvPlayer::Dispose() {
auto cancelled = pending_requests_.CancelAll();
for (auto& callback : cancelled.status) {
callback(-1);
callback(MPV_ERROR_UNINITIALIZED);
}
for (auto& callback : cancelled.properties) {
callback(-1, "");
@@ -446,7 +446,7 @@ void TestPendingPropertyWriteFailsOnDispose() {
player.Dispose();
Check(callback_count == 1, "dispose must complete a pending property write exactly once");
Check(status < 0, "dispose must fail a pending property write");
Check(status == MPV_ERROR_UNINITIALIZED, "dispose must cancel a pending property write as uninitialized");
player.Dispose();
Check(callback_count == 1, "repeated dispose must not complete a property write twice");
+6 -3
View File
@@ -379,9 +379,12 @@ static void mpv_plugin_handle_method_call(FlMethodChannel* channel, FlMethodCall
if (plezy::mpv_common::SetPropertyStatusSucceeded(error)) {
async_response = FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
} else {
const std::string description = plezy::mpv_common::SetPropertyErrorDescription(error);
async_response = FL_METHOD_RESPONSE(fl_method_error_response_new(
plezy::mpv_common::kSetPropertyFailedCode, description.c_str(), nullptr));
const char* error_code = plezy::mpv_common::SetPropertyErrorCode(error);
const std::string description = error == MPV_ERROR_UNINITIALIZED
? std::string("Player not initialized")
: plezy::mpv_common::SetPropertyErrorDescription(error);
async_response =
FL_METHOD_RESPONSE(fl_method_error_response_new(error_code, description.c_str(), nullptr));
}
fl_method_call_respond(method_call, async_response, nullptr);
g_object_unref(method_call);