Skip to content

Commit 083666f

Browse files
committed
Fix parallel loading missing notify and virtual bypass
1 parent 6b0ca19 commit 083666f

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

plugin_arch/PluginManager.hpp

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -465,12 +465,11 @@ class PluginManager {
465465
}
466466
std::rethrow_exception(result.error);
467467
}
468-
locator_.add(result.instance);
469-
plugins_.push_back({std::move(result.instance), std::move(result.loader),
470-
infos[result.info_idx].entry,
471-
infos[result.info_idx].deps});
472-
rebuild_name_index();
473-
wire_instance_tracked(plugins_.back(), config_map);
468+
// Wire through the same path as serial loading — ensures
469+
// notify_loaded fires and virtual load_and_wire overrides apply.
470+
wire_preloaded(std::move(result.instance), std::move(result.loader),
471+
infos[result.info_idx].entry,
472+
infos[result.info_idx].deps, config_map);
474473
}
475474
}
476475
}
@@ -1274,6 +1273,18 @@ class PluginManager {
12741273
loader = std::move(pl);
12751274
}
12761275

1276+
wire_preloaded(std::move(instance), std::move(loader), entry, deps,
1277+
config_map);
1278+
}
1279+
1280+
// Register a pre-loaded instance and wire it. Shared by load_and_wire
1281+
// (serial) and load_all_parallel (parallel). Ensures notify_loaded fires
1282+
// and wire_instance is called consistently.
1283+
void wire_preloaded(std::shared_ptr<IPlugin> instance,
1284+
std::optional<PluginLoader<IPlugin>> loader,
1285+
const PluginEntry& entry,
1286+
const std::vector<std::string>& deps,
1287+
const ConfigMap& config_map) {
12771288
locator_.add(instance);
12781289
plugins_.push_back(
12791290
{std::move(instance), std::move(loader), entry, deps});

0 commit comments

Comments
 (0)