Copy path to avoid it being invalidated by OkayToStartNewFile()
parent
2a56ba661e
commit
e2bf722fec
|
@ -369,8 +369,11 @@ static void PopulateMenuWithPathnames(Platform::MenuRef menu,
|
|||
|
||||
void GraphicsWindow::PopulateRecentFiles() {
|
||||
PopulateMenuWithPathnames(openRecentMenu, SS.recentFiles, [](const Platform::Path &path) {
|
||||
// OkayToStartNewFile could mutate recentFiles, which will invalidate path (which is a
|
||||
// refererence into the recentFiles vector), so take a copy of it here.
|
||||
Platform::Path pathCopy(path);
|
||||
if(!SS.OkayToStartNewFile()) return;
|
||||
SS.Load(path);
|
||||
SS.Load(pathCopy);
|
||||
});
|
||||
|
||||
PopulateMenuWithPathnames(linkRecentMenu, SS.recentFiles, [](const Platform::Path &path) {
|
||||
|
|
Loading…
Reference in New Issue