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 "Buffer.h"
#include "FileLoader.h"
bool Buffer::load_from_file(const char * filename) bool Buffer::load_from_file(const char * filename)
{ {
FileLoader fl; if (!m_fl.load(filename))
if (!fl.load(filename))
{ {
return false; 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; return true;

View File

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