Buffer: hold on to the FileLoader for now so the memory is not released
This commit is contained in:
parent
f31fac64ba
commit
5da9cde758
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user