Skip to content

Commit dac8a17

Browse files
committed
Faker: Improve err msg if XOpenDisplay !interposed
If a 3D application uses dlopen()/dlsym() to load X11 functions, then libdlfaker.so must be preloaded. Otherwise VirtualGL's interposed version of XOpenDisplay() will not be called, the X11 display's excluded status will not be added as a display extension, and faker::isDisplayExcluded() and faker::getDisplayCS() will fail. This commit adds a more instructive error message if one of those methods fails. Refer to #214
1 parent a0f97e7 commit dac8a17

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

server/faker.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (C)2004 Landmark Graphics Corporation
22
// Copyright (C)2005, 2006 Sun Microsystems, Inc.
3-
// Copyright (C)2009, 2011, 2013-2016, 2018-2022 D. R. Commander
3+
// Copyright (C)2009, 2011, 2013-2016, 2018-2022, 2025 D. R. Commander
44
//
55
// This library is free software and may be redistributed and/or modified under
66
// the terms of the wxWindows Library License, Version 3.1 or (at your option)
@@ -95,8 +95,10 @@ namespace faker
9595
XFindOnExtensionList(XEHeadOfExtensionList(obj), 0) ? 0 : 1;
9696
extData = XFindOnExtensionList(XEHeadOfExtensionList(obj),
9797
minExtensionNumber);
98-
ERRIFNOT(extData);
99-
ERRIFNOT(extData->private_data);
98+
if(!extData || !extData->private_data)
99+
THROW("VirtualGL extensions not found on X display. If the 3D\n"
100+
"[VGL] application uses dlopen()/dlsym() to load X11 functions, then\n"
101+
"[VGL] VirtualGL's dlopen() interposer must be preloaded.");
100102

101103
return *(bool *)extData->private_data;
102104
}
@@ -115,8 +117,10 @@ namespace faker
115117
XFindOnExtensionList(XEHeadOfExtensionList(obj), 0) ? 0 : 1;
116118
extData = XFindOnExtensionList(XEHeadOfExtensionList(obj),
117119
minExtensionNumber + 1);
118-
ERRIFNOT(extData);
119-
ERRIFNOT(extData->private_data);
120+
if(!extData || !extData->private_data)
121+
THROW("VirtualGL extensions not found on X display. If the 3D\n"
122+
"[VGL] application uses dlopen()/dlsym() to load X11 functions, then\n"
123+
"[VGL] VirtualGL's dlopen() interposer must be preloaded.");
120124

121125
return *(util::CriticalSection *)extData->private_data;
122126
}

0 commit comments

Comments
 (0)