forked from Foxyz/sync_replay_project
Stabilisation quick fixes: orderly close, visible version and update band, chat pop-ups on, Windows shaders and hwdec, render logs
- Close: hide the window, dispose every player, thumbnail job and the sound engine, leave, then close normally; Linux runner _exit (the NVIDIA EGL exit handler crashed 10/10 closes, 0/41 now); Windows tears down inside the message loop, then TerminateProcess; watchdogs. - Version under the Settings tab; an update band instead of a dot, never over a video; checks at start and every 4 hours. - Chat pop-ups default to All again. - Shader read-back compared as a list (old mpv joins with ','), so Windows stops turning shaders off; Windows hwdec auto-copy. - Render diagnostics (`mpv: render` lines); RAM-only demuxer cache pin silences the file-cache warning; a volume readout test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e537f9d5f8
commit
ea607c1a52
29 files changed
+873
-168
No files matched your search
@@ -1,11 +1,30 @@
|
||||
#include "flutter_window.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <optional>
|
||||
#include <thread>
|
||||
|
||||
#include <flutter/standard_method_codec.h>
|
||||
|
||||
#include "flutter/generated_plugin_registrant.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// Ends the process after |ms| whatever is still running: the app's close
|
||||
// (lib/src/platform/app_shutdown.dart) is bounded, but a native teardown
|
||||
// can block for good (media_kit_video's ~VideoOutput waits on a texture
|
||||
// callback the stopped engine never sends). The process must never stay
|
||||
// behind a hidden window.
|
||||
void ExitAfter(DWORD ms) {
|
||||
std::thread([ms] {
|
||||
::Sleep(ms);
|
||||
fflush(nullptr);
|
||||
::TerminateProcess(::GetCurrentProcess(), 0);
|
||||
}).detach();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
FlutterWindow::FlutterWindow(const flutter::DartProject& project)
|
||||
: project_(project) {}
|
||||
|
||||
@@ -60,6 +79,8 @@ bool FlutterWindow::OnCreate() {
|
||||
}
|
||||
|
||||
void FlutterWindow::OnDestroy() {
|
||||
// The engine and the plugins go now; the app released its players first.
|
||||
ExitAfter(3000);
|
||||
window_channel_ = nullptr;
|
||||
if (flutter_controller_) {
|
||||
flutter_controller_ = nullptr;
|
||||
@@ -72,6 +93,13 @@ LRESULT
|
||||
FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
|
||||
WPARAM const wparam,
|
||||
LPARAM const lparam) noexcept {
|
||||
// A close request starts the app's close (players, leave), at most a
|
||||
// few seconds; past 15 s the process ends anyway.
|
||||
if (message == WM_CLOSE && !close_requested_) {
|
||||
close_requested_ = true;
|
||||
ExitAfter(15000);
|
||||
}
|
||||
|
||||
// Give Flutter, including plugins, an opportunity to handle window messages.
|
||||
if (flutter_controller_) {
|
||||
std::optional<LRESULT> result =
|
||||
|
||||
@@ -34,6 +34,9 @@ class FlutterWindow : public Win32Window {
|
||||
// "starsync/window": `attention` flashes the taskbar entry while the
|
||||
// window is not in front (lib/src/platform/attention.dart).
|
||||
std::unique_ptr<flutter::MethodChannel<flutter::EncodableValue>> window_channel_;
|
||||
|
||||
// The first WM_CLOSE arms the exit watchdog.
|
||||
bool close_requested_ = false;
|
||||
};
|
||||
|
||||
#endif // RUNNER_FLUTTER_WINDOW_H_
|
||||
@@ -2,6 +2,8 @@
|
||||
#include <flutter/flutter_view_controller.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "flutter_window.h"
|
||||
#include "utils.h"
|
||||
|
||||
@@ -38,6 +40,13 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
|
||||
::DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
// The window closed through WM_CLOSE (the app disposed its mpv players
|
||||
// and left first), so the engine and plugins were torn down inside the
|
||||
// loop. End here without the CRT exit and DLL_PROCESS_DETACH: a driver
|
||||
// or libmpv detach handler can hang waiting on threads that are gone.
|
||||
// Nothing is left to flush but stdio.
|
||||
fflush(nullptr);
|
||||
::CoUninitialize();
|
||||
::TerminateProcess(::GetCurrentProcess(), EXIT_SUCCESS);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in new issue
Block a user