mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Prevent crash when attempting to restore a file multiple times.
We currently cannot restore multiple views of the same buffer properly. On the mac, we even crash. So do not try it, record each file only once in the last opened list. Fixes: #9483.
This commit is contained in:
parent
29705851cb
commit
c46162db23
@ -150,6 +150,16 @@ void LastOpenedSection::write(ostream & os) const
|
||||
void LastOpenedSection::add(FileName const & file, bool active)
|
||||
{
|
||||
LastOpenedFile lof(file, active);
|
||||
// check if file is already recorded (this can happen
|
||||
// with multiple buffer views). We do only record each
|
||||
// file once, since we cannot restore multiple views
|
||||
// currently, we even crash in some cases (see #9483).
|
||||
// FIXME: Add session support for multiple views of
|
||||
// the same buffer (split-view etc.).
|
||||
for (size_t i = 0; i < lastopened.size(); ++i) {
|
||||
if (lastopened[i].file_name == file)
|
||||
return;
|
||||
}
|
||||
lastopened.push_back(lof);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user