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 "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;
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user