refactor: replace raw object pointers with SmartPointer in ObjectsContext and update dependent codebases

This commit is contained in:
AndreaRigoni
2026-04-17 13:28:24 +00:00
parent 506b8f037f
commit 390fc44043
8 changed files with 57 additions and 41 deletions

View File

@@ -426,15 +426,15 @@ void ReferencePropertyWidget::refreshCombo() {
if (m_Context) {
const auto& objects = m_Context->GetObjects();
for (auto* obj : objects) {
if (m_RefProp->IsCompatible(obj)) {
for (const auto& obj : objects) {
if (m_RefProp->IsCompatible(obj.get())) {
QString label = QString::fromStdString(obj->GetInstanceName());
if (label.isEmpty()) {
label = QString::fromStdString(std::string(obj->GetClassName()));
}
// Add index suffix if name is empty to disambiguate
m_Combo->addItem(label, QVariant::fromValue((quintptr)obj));
if (obj == currentRef) {
m_Combo->addItem(label, QVariant::fromValue((quintptr)obj.get()));
if (obj.get() == currentRef) {
selectedIdx = m_Combo->count() - 1;
}
}