diff --git a/Changelog/2026-10-11-popout-embed-crash.md b/Changelog/2026-10-11-popout-embed-crash.md
new file mode 100644
index 0000000..88bc54b
--- /dev/null
+++ b/Changelog/2026-10-11-popout-embed-crash.md
@@ -0,0 +1,43 @@
+# Fix: a popped-out Mini Remote or Guardian crashed the client
+
+Follows the menu changes (`2026-10-11-character-and-server-menus.md`). Pairs with the RynthSuite
+change that draws `:popout` surfaces in the current context.
+
+## The crash
+
+Four crashes on 2026-10-11 had the same stack:
+
+```
+EndSceneDetour -> EngineFrameController.OnEndScene -> ImGuiPopOuts.RenderAll
+ -> ImGuiPanelHost.DrawPopped -> MiniRemoteFace.Draw -> DrawRynthAi
+ -> PluginManager.RenderEmbed -> (RynthAi) -> access violation in coreclr
+```
+
+- `ImGuiPopOuts` gives every popped-out panel its own ImGui context.
+- `PluginManager.RenderEmbed` called RynthAi from inside it. RynthAi then switched
+ to the main context, which isn't mid-frame there, and faulted.
+- An access violation isn't an exception `RenderEmbed`'s try/catch can stop, so the client died.
+- The "MAIN THREAD HANG DETECTED" line before each exit was the runtime writing the 700 MB crash
+ dump.
+
+## Fix
+
+- `PluginManager.RenderEmbed` checks the current ImGui context. When it isn't the one plugins
+ were given (a pop-out), the surface goes out as `name:popout`.
+ - RynthAi with the matching RynthSuite change draws it in the current context.
+ - Older plugins don't know the name and decline. The Mini Remote then shows the engine's own
+ slot grid, and the Guardian panel its "not ready" state, instead of crashing.
+- This covers every embedded surface: the Mini Remote window, the RynthAi dashboard's Mini Remote
+ drawer, and the Guardian panel.
+- It also returns "not ready" when no ImGui context is current.
+
+## Files
+
+- `src/RynthCore.Engine/Plugins/PluginManager.cs`: `RenderEmbed` (context check and the
+ `:popout` name), with the export call moved to `RenderEmbedCore`.
+- `src/RynthCore.Engine/ImGui/Panels/MiniRemoteFace.cs`: header note on the fallback.
+
+## Testing
+
+- The engine builds in Release, and ItemHudTests pass.
+- Not yet checked in game: the popped-out Mini Remote, with a current and with an older RynthAi.
diff --git a/src/RynthCore.Engine/ImGui/Panels/MiniRemoteFace.cs b/src/RynthCore.Engine/ImGui/Panels/MiniRemoteFace.cs
index 11da6d0..eb88899 100644
--- a/src/RynthCore.Engine/ImGui/Panels/MiniRemoteFace.cs
+++ b/src/RynthCore.Engine/ImGui/Panels/MiniRemoteFace.cs
@@ -12,8 +12,9 @@
// a resize by hand holds until then. While this window shows it, RynthAi keeps
// its own floating copy hidden, so there is one Mini Remote, not two.
//
-// Without RynthAi (not loaded, too old for the surface, not logged in yet, or
-// its embed failed) it is the engine's own grid (an idea from Silentkelpie's
+// Without RynthAi (not loaded, too old for the surface, not logged in yet,
+// popped out with a RynthAi older than 0.5.38, which can't draw in a pop-out's
+// context, or its embed failed) it is the engine's own grid (an idea from Silentkelpie's
// rynth PR #1, done as an engine face):
// slots the item's icon and carried count; an empty slot shows +
// click uses the slot's item (the same object if still carried, else a
diff --git a/src/RynthCore.Engine/Plugins/PluginManager.cs b/src/RynthCore.Engine/Plugins/PluginManager.cs
index f6298f4..587d34e 100644
--- a/src/RynthCore.Engine/Plugins/PluginManager.cs
+++ b/src/RynthCore.Engine/Plugins/PluginManager.cs
@@ -1249,21 +1249,56 @@ internal static partial class PluginManager
/// RenderEmbed results.
internal const int EmbedDrawn = 1, EmbedNotReady = 0, EmbedNoPlugin = -1, EmbedFailed = -2;
+ ///
+ /// Appended to an embed surface's name when the caller draws in another ImGui context than
+ /// the one plugins were given (a popped-out panel's own context). Only a plugin that knows
+ /// the suffix draws then, into the current context; an older one switches to the main
+ /// context, which is not mid-frame there, and faults inside cimgui (an access violation no
+ /// try/catch stops: 2026-10-11, the popped-out Mini Remote), so it must see a surface name
+ /// it doesn't know and decline.
+ ///
+ private static ReadOnlySpan PopOutSurfaceSuffix => ":popout"u8;
+
///
/// Lets the plugin named (display name contains it) draw the
/// surface (NUL-terminated) into the current ImGui window,
/// through its optional RynthPluginRenderEmbed export. The caller has begun a child of
- /// in the main ImGui context; the plugin draws only inside it and
- /// reports the content size it wants in (zero when it didn't say).
+ /// ; the plugin draws only inside it and reports the content size it
+ /// wants in (zero when it didn't say). In a context other than the
+ /// plugins' (a pop-out), the surface goes out as "name:popout" (see
+ /// ).
/// Render thread only. Returns , (the
- /// plugin isn't ready: before login, no ImGui context), (not
- /// loaded, or too old to have the export) or (it threw: the export
- /// is switched off for this session; the plugin keeps running).
+ /// plugin isn't ready: before login, no ImGui context, or too old to draw in a pop-out),
+ /// (not loaded, or too old to have the export) or
+ /// (it threw: the export is switched off for this session; the
+ /// plugin keeps running).
///
internal static unsafe int RenderEmbed(string pluginName, ReadOnlySpan surfaceUtf8, System.Numerics.Vector2 size, out System.Numerics.Vector2 want)
{
want = System.Numerics.Vector2.Zero;
if (!_loginCompleteObserved) return EmbedNotReady; // same not-in-world guard as RenderAll
+ IntPtr current = ImGuiNET.ImGui.GetCurrentContext();
+ if (current == IntPtr.Zero) return EmbedNotReady;
+ if (current != _api.ImGuiContext)
+ {
+ // "name\0" -> "name:popout\0" on the stack; surface names are a few bytes.
+ int nameLen = surfaceUtf8.IndexOf((byte)0);
+ if (nameLen < 0) nameLen = surfaceUtf8.Length;
+ int total = nameLen + PopOutSurfaceSuffix.Length + 1;
+ if (total > 128) return EmbedNotReady;
+ Span popOut = stackalloc byte[total];
+ surfaceUtf8[..nameLen].CopyTo(popOut);
+ PopOutSurfaceSuffix.CopyTo(popOut[nameLen..]);
+ popOut[^1] = 0;
+ return RenderEmbedCore(pluginName, popOut, size, out want);
+ }
+ return RenderEmbedCore(pluginName, surfaceUtf8, size, out want);
+ }
+
+ /// The export call behind , with the surface name already final.
+ private static unsafe int RenderEmbedCore(string pluginName, ReadOnlySpan surfaceUtf8, System.Numerics.Vector2 size, out System.Numerics.Vector2 want)
+ {
+ want = System.Numerics.Vector2.Zero;
LoadedPlugin[] plugins = System.Threading.Volatile.Read(ref _pluginsRenderSnapshot);
for (int i = 0; i < plugins.Length; i++)
{