fixed memory leak

This commit is contained in:
louis 2016-09-25 12:01:41 +02:00
parent e75aaa6f33
commit 0ef5487e6f
2 changed files with 18 additions and 2 deletions

View File

@ -1658,7 +1658,9 @@ void cLeMenuRecordings::ClearCurrentElement(void) {
}
void cLeMenuRecordings::Set(const cRecording *recording, int level, int total, int New) {
if (!this->recording) {
this->recording = new cRecording(recording->FileName());
}
this->level = level;
this->total = total;
this->New = New;
@ -1787,6 +1789,18 @@ void cLeMenuRecordings::RenderCurrent(void) {
currentRecording->Parse();
}
void cLeMenuRecordings::Clear(bool forceClearBackground) {
delete recording;
recording = NULL;
cListElement::Clear(forceClearBackground);
}
void cLeMenuRecordings::Close(void) {
delete recording;
recording = NULL;
cListElement::Close();
}
char *cLeMenuRecordings::RecName(const char *path, int level) {
char *recName;
const char *startName = path;

View File

@ -40,7 +40,7 @@ public:
bool DoScroll(void) { return current; };
void Render(void);
virtual void RenderCurrent(void) { };
void Close(void);
virtual void Close(void);
int ListShiftTime(void) { return ShiftTime(); };
int ShiftDistance(void);
eOrientation ShiftOrientation(void);
@ -283,6 +283,8 @@ public:
void Set(const cRecording *recording, int level, int total, int New);
bool Parse(bool forced = true);
void RenderCurrent(void);
void Clear(bool forceClearBackground = false);
void Close(void);
};
/******************************************************************