Buffer: hold on to the FileLoader for now so the memory is not released

This commit is contained in:
Josh Holtrop 2016-07-10 17:23:30 -04:00
parent f31fac64ba
commit 5da9cde758
2 changed files with 6 additions and 6 deletions

View File

@ -1,18 +1,15 @@
#include "Buffer.h"
#include "FileLoader.h"
bool Buffer::load_from_file(const char * filename)
{
FileLoader fl;
if (!fl.load(filename))
if (!m_fl.load(filename))
{
return false;
}
for (size_t i = 0, num_lines = fl.num_lines(); i < num_lines; i++)
for (size_t i = 0, num_lines = m_fl.num_lines(); i < num_lines; i++)
{
m_lines.push_back(fl.get_line(i));
m_lines.push_back(m_fl.get_line(i));
}
return true;

View File

@ -4,6 +4,7 @@
#include <list>
#include <memory>
#include "Text.h"
#include "FileLoader.h"
class Buffer
{
@ -24,6 +25,8 @@ public:
protected:
LinesType m_lines;
/* TODO: delete this */
FileLoader m_fl;
};
#endif