diff --git a/src/main.cpp b/src/main.cpp index 759569f6..49be8a23 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,7 +21,6 @@ using namespace polybar; int main(int argc, char** argv) { - // std::cout << x << std::Endl; // clang-format off const command_line::options opts{ command_line::option{"-h", "--help", "Show help options"}, diff --git a/src/x11/connection.cpp b/src/x11/connection.cpp index 58351185..383153e9 100644 --- a/src/x11/connection.cpp +++ b/src/x11/connection.cpp @@ -62,9 +62,13 @@ connection::connection(Display* dsp) : base_type(XGetXCBConnection(dsp)), m_disp } connection::~connection() { - disconnect(); - std::for_each(m_visual.begin(), m_visual.end(), [=](pair p) { XFree(p.second); }); - m_visual.clear(); + if (m_display != nullptr) { + XCloseDisplay(m_display); + } else { + disconnect(); + std::for_each(m_visual.begin(), m_visual.end(), [=](pair p) { XFree(p.second); }); + m_visual.clear(); + } } void connection::pack_values(uint32_t mask, const uint32_t* src, uint32_t* dest) { diff --git a/src/x11/fonts.cpp b/src/x11/fonts.cpp index ec1266fd..c6cfab47 100644 --- a/src/x11/fonts.cpp +++ b/src/x11/fonts.cpp @@ -37,11 +37,7 @@ font_manager::font_manager(connection& conn, const logger& logger) , m_logger(logger) , m_display(m_connection) , m_visual(m_connection.visual()) - , m_colormap(XDefaultColormap(m_display, m_connection.default_screen())) { - if (!XftInit(nullptr) || !XftInitFtLibrary()) { - throw application_error("Could not initialize Xft library"); - } -} + , m_colormap(XDefaultColormap(m_display, m_connection.default_screen())) {} font_manager::~font_manager() { cleanup();