mirror of
https://github.com/polybar/polybar.git
synced 2024-11-25 13:55:47 -05:00
fix(xresources): Deallocate memory
This commit is contained in:
parent
83f7d2ce91
commit
a33c15b3ad
2 changed files with 14 additions and 1 deletions
|
@ -12,6 +12,7 @@ class xresource_manager {
|
||||||
static make_type make();
|
static make_type make();
|
||||||
|
|
||||||
explicit xresource_manager();
|
explicit xresource_manager();
|
||||||
|
~xresource_manager();
|
||||||
|
|
||||||
string get_string(string name, string fallback = "") const;
|
string get_string(string name, string fallback = "") const;
|
||||||
float get_float(string name, float fallback = 0.0f) const;
|
float get_float(string name, float fallback = 0.0f) const;
|
||||||
|
@ -21,7 +22,7 @@ class xresource_manager {
|
||||||
string load_value(const string& key, const string& res_type, size_t n) const;
|
string load_value(const string& key, const string& res_type, size_t n) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char* m_manager = nullptr;
|
char* m_manager{nullptr};
|
||||||
XrmDatabase m_db;
|
XrmDatabase m_db;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,18 @@ xresource_manager::xresource_manager() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deconstruct instance
|
||||||
|
*/
|
||||||
|
xresource_manager::~xresource_manager() {
|
||||||
|
if (m_db != nullptr) {
|
||||||
|
XrmDestroyDatabase(m_db);
|
||||||
|
}
|
||||||
|
if (m_manager != nullptr) {
|
||||||
|
XFree(m_manager);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get string value from the X resource db
|
* Get string value from the X resource db
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue