Fix hot-reload ABI break: move reloadConfig() to end of ICoreInterface
ICoreInterface is the vtable ABI contract between the already-loaded Plugin and a freshly hot-reloaded Core. reloadConfig() was added mid-interface (after getConfigJson), which shifted every later vtable slot — so the still-running Plugin's calls to saveState/restoreState/getStateFormatVersion/onPluginEvent dispatched to the wrong methods on the new Core. Symptom: state restore read a garbage version (2303262719), threw basic_string::_M_create, and left the Core uninitialized (onPluginEvent ignored, initialized=false). Move reloadConfig() to the very end of the interface (append-only) so all pre-existing slots keep their indices. Add a comment documenting the rule. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
222aee8889
commit
dede07748a
1 file changed
+9
-3
@@ -93,9 +93,6 @@ namespace Echoion::Api
|
||||
updateConfigJson(const std::string& configJson) = 0;
|
||||
[[nodiscard]] virtual Result<std::string> getConfigJson() const = 0;
|
||||
|
||||
// Reload configuration from the config file on disk.
|
||||
virtual Result<void> reloadConfig() = 0;
|
||||
|
||||
// Hot reload - using serialization instead of HotReloadState
|
||||
// Returns opaque handle that Plugin just passes back
|
||||
[[nodiscard]] virtual Result<std::string> prepareForHotReload() = 0;
|
||||
@@ -152,6 +149,15 @@ namespace Echoion::Api
|
||||
getConfigHandle() const = 0;
|
||||
virtual Result<void>
|
||||
updateConfigFromHandle(AppConfigHandle config) = 0;
|
||||
|
||||
// Reload configuration from the config file on disk.
|
||||
// NOTE: append-only. ICoreInterface is the hot-reload ABI contract
|
||||
// between the (already-loaded) Plugin and a freshly reloaded Core.
|
||||
// Inserting/removing a virtual method anywhere above shifts every
|
||||
// later vtable slot, so the old Plugin would call the wrong methods
|
||||
// on the new Core (state-transfer corruption on hot reload). Only
|
||||
// ever add new virtuals at the very end.
|
||||
virtual Result<void> reloadConfig() = 0;
|
||||
};
|
||||
|
||||
} // namespace Echoion::Api
|
||||
Reference in new issue
Block a user