Free movingBar memory on exit

This commit is contained in:
Christian Göttsche 2020-09-11 20:14:56 +02:00 committed by cgzones
parent 8a849bc85a
commit 71c068ad28
3 changed files with 11 additions and 0 deletions

View File

@ -27,6 +27,13 @@ static const char* const MetersMovingKeys[] = {"Space", "Enter", "Up", "Dn", "<-
static int MetersMovingEvents[] = {' ', 13, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, ERR, KEY_DC, KEY_F(10)};
static FunctionBar* Meters_movingBar = NULL;
void MetersPanel_cleanup() {
if (Meters_movingBar) {
FunctionBar_delete(Meters_movingBar);
Meters_movingBar = NULL;
}
}
static void MetersPanel_delete(Object* object) {
Panel* super = (Panel*) object;
MetersPanel* this = (MetersPanel*) object;

View File

@ -24,6 +24,8 @@ struct MetersPanel_ {
bool moving;
};
void MetersPanel_cleanup(void);
void MetersPanel_setMoving(MetersPanel* this, bool moving);
extern PanelClass MetersPanel_class;

2
htop.c
View File

@ -12,6 +12,7 @@ in the source distribution for its full text.
#include "ColumnsPanel.h"
#include "CRT.h"
#include "MainPanel.h"
#include "MetersPanel.h"
#include "ProcessList.h"
#include "ScreenManager.h"
#include "Settings.h"
@ -277,6 +278,7 @@ int main(int argc, char** argv) {
ProcessList_delete(pl);
ScreenManager_delete(scr);
MetersPanel_cleanup();
UsersTable_delete(ut);
Settings_delete(settings);