Skip to content

Commit

Permalink
Fixed an ugly crash bug when deleting the last clip of the files panel.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Oct 26, 2023
1 parent 70b176f commit ca634ed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions mrv2/docs/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ v0.8.3
- Fixed Annotations shifting when moving clips around in the Timeline Viewport
(feature of v0.9.0 not yet finished by Darby).
- Added support for HDR Radiance (.hdr) format.
- Fixed a crash when deleting the last clip from the Files Panel.


v0.8.2
Expand Down
3 changes: 0 additions & 3 deletions mrv2/lib/mrvPanels/mrvFilesPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,6 @@ namespace mrv

file::Path lastPath;

const std::string tmpdir = tmppath() + "/";

for (size_t i = 0; i < numFiles; ++i)
{
const auto& media = files->getItem(i);
Expand Down Expand Up @@ -417,7 +415,6 @@ namespace mrv

void FilesPanel::redraw()
{

TLRENDER_P();

otio::RationalTime time = otio::RationalTime(0.0, 1.0);
Expand Down
9 changes: 4 additions & 5 deletions mrv2/lib/mrvUI/mrvMenus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ namespace mrv
char buf[256];

const auto model = ui->app->filesModel();
const auto files = model->observeFiles();
size_t numFiles = files->getSize();
const auto& files = model->observeFiles()->get();
size_t numFiles = files.size();

menu->clear();

Expand Down Expand Up @@ -909,10 +909,9 @@ namespace mrv
if (options.showMarkers)
item->set();

const int aIndex = ui->app->filesModel()->observeAIndex()->get();
if (numFiles > 0 && aIndex >= 0)
const int aIndex = model->observeAIndex()->get();
if (numFiles > 0 && aIndex >= 0 && aIndex < numFiles)
{
const auto files = ui->app->filesModel()->observeFiles()->get();
std::string fileName = files[aIndex]->path.get(-1, false);

const std::regex& regex = version_regex(ui, false);
Expand Down

0 comments on commit ca634ed

Please sign in to comment.