Fix GHOST crash on X11 with recent DPI changes on some systems.

This commit is contained in:
Brecht Van Lommel 2017-03-25 19:29:37 +01:00
parent fe3fb23697
commit 393efccb19
1 changed files with 10 additions and 8 deletions

View File

@ -1683,15 +1683,17 @@ getDPIHint()
{
/* Try to read DPI setting set using xrdb */
char* resMan = XResourceManagerString(m_display);
XrmDatabase xrdb = XrmGetStringDatabase(resMan);
if (xrdb) {
char* type = NULL;
XrmValue val;
if (resMan) {
XrmDatabase xrdb = XrmGetStringDatabase(resMan);
if (xrdb) {
char* type = NULL;
XrmValue val;
int success = XrmGetResource(xrdb, "Xft.dpi", "Xft.Dpi", &type, &val);
if (success && type) {
if (strcmp(type, "String") == 0) {
return atoi((char*)val.addr);
int success = XrmGetResource(xrdb, "Xft.dpi", "Xft.Dpi", &type, &val);
if (success && type) {
if (strcmp(type, "String") == 0) {
return atoi((char*)val.addr);
}
}
}
}