diff --git a/include/x11/xresources.hpp b/include/x11/xresources.hpp index 5e132f9e..194bca28 100644 --- a/include/x11/xresources.hpp +++ b/include/x11/xresources.hpp @@ -12,6 +12,7 @@ class xresource_manager { static make_type make(); explicit xresource_manager(); + ~xresource_manager(); string get_string(string name, string fallback = "") 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; private: - char* m_manager = nullptr; + char* m_manager{nullptr}; XrmDatabase m_db; }; diff --git a/src/x11/xresources.cpp b/src/x11/xresources.cpp index 7057ec06..d7e99769 100644 --- a/src/x11/xresources.cpp +++ b/src/x11/xresources.cpp @@ -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 */