refactor: make shared_qobject_ptr ctor explicit
This turns issues like creating two shared ptrs from a single raw ptr from popping up at runtime, instead making them a compile error. Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
@ -26,11 +26,11 @@ class BasicFolderLoadTask : public Task {
|
||||
public:
|
||||
BasicFolderLoadTask(QDir dir) : Task(nullptr, false), m_dir(dir), m_result(new Result), m_thread_to_spawn_into(thread())
|
||||
{
|
||||
m_create_func = [](QFileInfo const& entry) -> Resource* {
|
||||
return new Resource(entry);
|
||||
m_create_func = [](QFileInfo const& entry) -> Resource::Ptr {
|
||||
return makeShared<Resource>(entry);
|
||||
};
|
||||
}
|
||||
BasicFolderLoadTask(QDir dir, std::function<Resource*(QFileInfo const&)> create_function)
|
||||
BasicFolderLoadTask(QDir dir, std::function<Resource::Ptr(QFileInfo const&)> create_function)
|
||||
: Task(nullptr, false), m_dir(dir), m_result(new Result), m_create_func(std::move(create_function)), m_thread_to_spawn_into(thread())
|
||||
{}
|
||||
|
||||
@ -65,7 +65,7 @@ private:
|
||||
|
||||
std::atomic<bool> m_aborted = false;
|
||||
|
||||
std::function<Resource*(QFileInfo const&)> m_create_func;
|
||||
std::function<Resource::Ptr(QFileInfo const&)> m_create_func;
|
||||
|
||||
/** This is the thread in which we should put new mod objects */
|
||||
QThread* m_thread_to_spawn_into;
|
||||
|
Reference in New Issue
Block a user