diff --git a/MobileGL/MG_Backend/Init.cpp b/MobileGL/MG_Backend/Init.cpp index 0bf7aba6..531bd8c1 100644 --- a/MobileGL/MG_Backend/Init.cpp +++ b/MobileGL/MG_Backend/Init.cpp @@ -14,6 +14,7 @@ #if MOBILEGL_BUILD_DISAGGREGATED #include #include +#include // MGPipeForgetAllPublications, at the end of ShutdownSplitRoles #include #include // InstallPipeSessionFailHook, installed at step 0 below #include @@ -398,6 +399,9 @@ namespace MobileGL::MG_Backend { // and every later split bring-up in the process fails at CreateBackend's m_backend!=null // guard. MG_Remote::Server::ServerLoopInstance().Stop(); + // The server's twins died with the session; the frontend objects that are destroyed after + // this (the GL context's) have nothing left on the other side to delete. + MG_Pipe::MGPipeForgetAllPublications(); } #endif diff --git a/MobileGL/MG_Impl/Pipe/PipeFill.cpp b/MobileGL/MG_Impl/Pipe/PipeFill.cpp index 1817ce21..3e7264a0 100644 --- a/MobileGL/MG_Impl/Pipe/PipeFill.cpp +++ b/MobileGL/MG_Impl/Pipe/PipeFill.cpp @@ -1828,6 +1828,11 @@ namespace MobileGL::MG_Pipe { *entry = Entry{}; } + void Clear() { + for (auto& table : m_kinds) table.clear(); + m_band.clear(); + } + private: struct Entry { Uint32 Gen = 0; @@ -1892,6 +1897,8 @@ namespace MobileGL::MG_Pipe { PublicationLatch().NoteUnpublished(kind, handle); } + void MGPipeForgetAllPublications() { PublicationLatch().Clear(); } + // THE GATE ITSELF, AS AN OBSERVABLE (ID-39, widened by S-3 / ID-41). Every P4a birth hook // below and every `wants()` row in the walk resolve through FamilyIsLive / // P4aFamilyHasItsConsumer / P4aFamilyDependenciesAreSet, and none of the three is reachable diff --git a/MobileGL/MG_Pipe/PipeMutation.h b/MobileGL/MG_Pipe/PipeMutation.h index 4382c15b..78ce8ba4 100644 --- a/MobileGL/MG_Pipe/PipeMutation.h +++ b/MobileGL/MG_Pipe/PipeMutation.h @@ -341,6 +341,12 @@ namespace MobileGL::MG_Pipe { void MGPipeNoteHandlePublished(MGPipeKind kind, MGPipeHandle handle); Bool MGPipeHandleIsPublished(MGPipeKind kind, MGPipeHandle handle); void MGPipeNoteHandleUnpublished(MGPipeKind kind, MGPipeHandle handle); + // THE SESSION IS GONE, AND EVERYTHING IT HELD WITH IT. Called once the split roles are shut + // down: every object the server twinned died with the session, so nothing is published any + // more - and the frontend objects that die after it (MobileGL::Destroy resets the GL context + // after ShutdownSplitRoles, by design) must not route a delete for a twin that no longer + // exists to whichever applier is installed now, which asserts on the unknown handle. + void MGPipeForgetAllPublications(); // ---- the four mints (pure allocator work, no family knowledge) ---- //