fix(valgrind): Suppress Xrm warnings

This commit is contained in:
Michael Carlberg 2016-12-14 06:52:58 +01:00
parent 5077325044
commit 357e95335a
3 changed files with 23 additions and 6 deletions

View File

@ -66,3 +66,20 @@
...
...
}
{
xresource manager
Memcheck:Leak
match-leak-kinds: definite
fun:realloc
obj:/usr/lib/libX11.so.6.3.0
obj:/usr/lib/libX11.so.6.3.0
obj:/usr/lib/libX11.so.6.3.0
fun:_XlcCreateLC
fun:_XlcDefaultLoader
fun:_XOpenLC
fun:_XrmInitParseInfo
obj:/usr/lib/libX11.so.6.3.0
fun:XrmGetStringDatabase
...
...
}

View File

@ -1,5 +1,6 @@
#pragma once
#include <X11/X.h>
#include <X11/Xresource.h>
#include "common.hpp"
@ -22,8 +23,9 @@ class xresource_manager {
string load_value(const string& key, const string& res_type, size_t n) const;
private:
char* m_manager{nullptr};
Display* m_display{nullptr};
XrmDatabase m_db;
char* m_manager{nullptr};
};
POLYBAR_NS_END

View File

@ -22,13 +22,11 @@ xresource_manager::make_type xresource_manager::make() {
xresource_manager::xresource_manager() {
XrmInitialize();
if (xlib::get_display() == nullptr) {
if ((m_display = xlib::get_display()) == nullptr) {
return;
}
if ((m_manager = XResourceManagerString(xlib::get_display())) == nullptr) {
} else if ((m_manager = XResourceManagerString(xlib::get_display())) == nullptr) {
return;
}
if ((m_db = XrmGetStringDatabase(m_manager)) == nullptr) {
} else if ((m_db = XrmGetStringDatabase(m_manager)) == nullptr) {
return;
}
}