fix Buffer constructor exception safety
This commit is contained in:
parent
d4216efd75
commit
a11bccaa12
|
@ -14,7 +14,8 @@ namespace Kakoune
|
||||||
|
|
||||||
Buffer::Buffer(String name, Flags flags, std::vector<String> lines,
|
Buffer::Buffer(String name, Flags flags, std::vector<String> lines,
|
||||||
time_t fs_timestamp)
|
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_history(), m_history_cursor(m_history.begin()),
|
||||||
m_last_save_undo_index(0),
|
m_last_save_undo_index(0),
|
||||||
m_timestamp(0),
|
m_timestamp(0),
|
||||||
|
@ -25,9 +26,6 @@ Buffer::Buffer(String name, Flags flags, std::vector<String> lines,
|
||||||
{
|
{
|
||||||
BufferManager::instance().register_buffer(*this);
|
BufferManager::instance().register_buffer(*this);
|
||||||
|
|
||||||
if (flags & Flags::File)
|
|
||||||
m_name = real_path(m_name);
|
|
||||||
|
|
||||||
if (lines.empty())
|
if (lines.empty())
|
||||||
lines.emplace_back("\n");
|
lines.emplace_back("\n");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user