projectexplorer/mainwindow: close sequence if it's open before deleting it

This commit is contained in:
itsmattkc
2020-04-07 03:11:50 +10:00
parent cf04cad238
commit 6d6b2b237e
3 changed files with 23 additions and 0 deletions
@@ -32,6 +32,7 @@
#include "dialog/footageproperties/footageproperties.h"
#include "dialog/sequence/sequence.h"
#include "widget/menu/menu.h"
#include "window/mainwindow/mainwindow.h"
OLIVE_NAMESPACE_ENTER
@@ -422,6 +423,15 @@ void ProjectExplorer::DeleteSelected()
foreach (Item* item, selected) {
ItemPtr item_ptr = item->get_shared_ptr();
// If this is a sequence, close it
if (item_ptr->type() == Item::kSequence) {
Sequence* s = static_cast<Sequence*>(item_ptr.get());
if (Core::instance()->main_window()->IsSequenceOpen(s)) {
Core::instance()->main_window()->CloseSequence(s);
}
}
new ProjectViewModel::RemoveItemCommand(&model_, item_ptr, command);
}