fixed qt assert when importing files

This commit is contained in:
itsmattkc
2021-04-08 12:42:09 +10:00
parent cb75e37e77
commit ff9e9eb90b
3 changed files with 11 additions and 8 deletions
+4 -4
View File
@@ -115,14 +115,14 @@ void ProjectImportTask::Import(Folder *folder, QFileInfoList import, int &counte
footage->SetLabel(file_info.fileName());
if (footage->IsValid()) {
// Move footage to main thread
footage->moveToThread(folder->thread());
// See if this footage is an image sequence
ValidateImageSequence(footage, import, i);
// Create undoable command that adds the items to the model
parent_command->add_child(new NodeAddCommand(folder->parent(), footage));
NodeAddCommand* nac = new NodeAddCommand(folder->parent(), footage);
nac->PushToThread(folder->thread());
parent_command->add_child(nac);
parent_command->add_child(new FolderAddChild(folder, footage));
} else {
// Add to list so we can tell the user about it later
+5 -4
View File
@@ -89,14 +89,15 @@ NodeAddCommand::NodeAddCommand(NodeGraph *graph, Node *node) :
graph_(graph),
node_(node)
{
if (memory_manager_.thread() != node->thread()) {
memory_manager_.moveToThread(node_->thread());
}
// Ensures that when this command is destroyed, if redo() is never called again, the node will be destroyed too
node_->setParent(&memory_manager_);
}
void NodeAddCommand::PushToThread(QThread *thread)
{
memory_manager_.moveToThread(thread);
}
void NodeAddCommand::redo()
{
node_->setParent(graph_);
+2
View File
@@ -76,6 +76,8 @@ class NodeAddCommand : public UndoCommand {
public:
NodeAddCommand(NodeGraph* graph, Node* node);
void PushToThread(QThread* thread);
virtual Project* GetRelevantProject() const override;
virtual void redo() override;