fix: don't give shared pointer to obj. external to the model
It causes some weird problems and adds refcounting overhead. Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
parent
97a74d5c1f
commit
92aa24ae34
10 changed files with 58 additions and 54 deletions
|
@ -226,9 +226,9 @@ bool ModFolderModel::stopWatching()
|
|||
return ResourceFolderModel::stopWatching({ m_dir.absolutePath(), indexDir().absolutePath() });
|
||||
}
|
||||
|
||||
auto ModFolderModel::selectedMods(QModelIndexList& indexes) -> QList<Mod::Ptr>
|
||||
auto ModFolderModel::selectedMods(QModelIndexList& indexes) -> QList<Mod*>
|
||||
{
|
||||
QList<Mod::Ptr> selected_resources;
|
||||
QList<Mod*> selected_resources;
|
||||
for (auto i : indexes) {
|
||||
if(i.column() != 0)
|
||||
continue;
|
||||
|
@ -238,12 +238,13 @@ auto ModFolderModel::selectedMods(QModelIndexList& indexes) -> QList<Mod::Ptr>
|
|||
return selected_resources;
|
||||
}
|
||||
|
||||
auto ModFolderModel::allMods() -> QList<Mod::Ptr>
|
||||
auto ModFolderModel::allMods() -> QList<Mod*>
|
||||
{
|
||||
QList<Mod::Ptr> mods;
|
||||
QList<Mod*> mods;
|
||||
|
||||
for (auto res : m_resources)
|
||||
for (auto& res : m_resources) {
|
||||
mods.append(static_cast<Mod*>(res.get()));
|
||||
}
|
||||
|
||||
return mods;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue