Skip to content

Commit c97b67c

Browse files
committed
Update CFileArchive.h
1 parent 38084b2 commit c97b67c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

include/nbl/system/CFileArchive.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,14 @@ class CFileArchive : public IFileArchive
105105
}
106106

107107
protected:
108-
CFileArchive(path&& _defaultAbsolutePath, system::logger_opt_smart_ptr&& logger, core::vector<SListEntry> _items) :
108+
CFileArchive(path&& _defaultAbsolutePath, system::logger_opt_smart_ptr&& logger, core::vector<IFileArchive::SFileList::SEntry> _items) :
109109
IFileArchive(std::move(_defaultAbsolutePath),std::move(logger))
110110
{
111-
m_items = std::move(_items);
112-
std::sort(m_items.begin(),m_items.end());
111+
auto itemsSharedPtr = std::make_shared<std::vector<IFileArchive::SFileList::SEntry>>(std::move(_items));
112+
std::sort(itemsSharedPtr->begin(), itemsSharedPtr->end());
113+
m_items.store(itemsSharedPtr);
113114

114-
const auto fileCount = m_items.size();
115+
const auto fileCount = itemsSharedPtr->size();
115116
m_filesBuffer = (std::byte*)_NBL_ALIGNED_MALLOC(fileCount*SIZEOF_INNER_ARCHIVE_FILE, ALIGNOF_INNER_ARCHIVE_FILE);
116117
m_fileFlags = (std::atomic_flag*)_NBL_ALIGNED_MALLOC(fileCount*sizeof(std::atomic_flag), alignof(std::atomic_flag));
117118
for (size_t i=0u; i<fileCount; i++)

0 commit comments

Comments
 (0)