summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Uwe Broulik <[email protected]>2015-11-08 02:27:19 +0100
committerKai Uwe Broulik <[email protected]>2015-11-08 02:55:05 +0100
commit24f89aacb568297aa9ebfa7fd7eed2c294bcaf2b (patch)
tree511e36ec08e2cbfff723d72a751fadafc4fb3f3f
parente419475161940c453ff1aa1fd2e4f6ff337f9f41 (diff)
Add runtime X11 guard
This fixes Gwenview crashing when viewing images on Wayland
-rw-r--r--lib/cms/cmsprofile.cpp53
1 files changed, 27 insertions, 26 deletions
diff --git a/lib/cms/cmsprofile.cpp b/lib/cms/cmsprofile.cpp
index 6b58951..56f38d5 100644
--- a/lib/cms/cmsprofile.cpp
+++ b/lib/cms/cmsprofile.cpp
@@ -212,32 +212,33 @@ Profile::Ptr Profile::getMonitorProfile()
// Get the profile from you config file if the user has set it.
// if the user allows override through the atom, do this:
#ifdef HAVE_X11
-
- // get the current screen...
- int screen = -1;
-
- Atom type;
- int format;
- unsigned long nitems;
- unsigned long bytes_after;
- quint8 *str;
-
- static Atom icc_atom = XInternAtom(QX11Info::display(), "_ICC_PROFILE", True);
-
- if (XGetWindowProperty(QX11Info::display(),
- QX11Info::appRootWindow(screen),
- icc_atom,
- 0,
- INT_MAX,
- False,
- XA_CARDINAL,
- &type,
- &format,
- &nitems,
- &bytes_after,
- (unsigned char **) &str) == Success
- ) {
- hProfile = cmsOpenProfileFromMem((void*)str, nitems);
+ if (QX11Info::isPlatformX11()) {
+ // get the current screen...
+ int screen = -1;
+
+ Atom type;
+ int format;
+ unsigned long nitems;
+ unsigned long bytes_after;
+ quint8 *str;
+
+ static Atom icc_atom = XInternAtom(QX11Info::display(), "_ICC_PROFILE", True);
+
+ if (XGetWindowProperty(QX11Info::display(),
+ QX11Info::appRootWindow(screen),
+ icc_atom,
+ 0,
+ INT_MAX,
+ False,
+ XA_CARDINAL,
+ &type,
+ &format,
+ &nitems,
+ &bytes_after,
+ (unsigned char **) &str) == Success
+ ) {
+ hProfile = cmsOpenProfileFromMem((void*)str, nitems);
+ }
}
#endif
if (!hProfile) {