1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-28 22:22:41 +03:00

fix Buffer constructor exception safety

This commit is contained in:
Maxime Coste 2013-11-07 21:42:51 +00:00
parent d4216efd75
commit a11bccaa12

View File

@ -14,7 +14,8 @@ namespace Kakoune
Buffer::Buffer(String name, Flags flags, std::vector<String> lines,
time_t fs_timestamp)
: m_name(std::move(name)), m_flags(flags | Flags::NoUndo),
: m_name(flags & Flags::File ? real_path(parse_filename(name)) : std::move(name)),
m_flags(flags | Flags::NoUndo),
m_history(), m_history_cursor(m_history.begin()),
m_last_save_undo_index(0),
m_timestamp(0),
@ -25,9 +26,6 @@ Buffer::Buffer(String name, Flags flags, std::vector<String> lines,
{
BufferManager::instance().register_buffer(*this);
if (flags & Flags::File)
m_name = real_path(m_name);
if (lines.empty())
lines.emplace_back("\n");