core/reloader: fix late creation of Reloadable types

This commit is contained in:
outfoxxed 2024-04-19 15:43:26 -07:00
parent 61812343f5
commit 6eb68d2cd7
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
13 changed files with 87 additions and 48 deletions

View file

@ -64,7 +64,7 @@ void Variants::onReload(QObject* oldInstance) {
auto* instance = qobject_cast<Reloadable*>(instanceObj);
if (instance != nullptr) instance->onReload(oldInstance);
if (instance != nullptr) instance->reload(oldInstance);
else Reloadable::reloadChildrenRecursive(instanceObj, oldInstance);
}
@ -168,7 +168,7 @@ void Variants::updateVariants() {
this->mInstances.insert(variant, instance);
if (this->loaded) {
if (auto* reloadable = qobject_cast<Reloadable*>(instance)) reloadable->onReload(nullptr);
if (auto* reloadable = qobject_cast<Reloadable*>(instance)) reloadable->reload(nullptr);
else Reloadable::reloadChildrenRecursive(instance, nullptr);
}
}