Skip to content

Commit 80c880d

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 d2469f4 commit 80c880d

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

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-2021 D. R. Commander
3+
// Copyright (C)2009, 2011, 2013-2016, 2018-2021, 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)
@@ -72,8 +72,10 @@ namespace faker
7272
XFindOnExtensionList(XEHeadOfExtensionList(obj), 0) ? 0 : 1;
7373
extData = XFindOnExtensionList(XEHeadOfExtensionList(obj),
7474
minExtensionNumber);
75-
ERRIFNOT(extData);
76-
ERRIFNOT(extData->private_data);
75+
if(!extData || !extData->private_data)
76+
THROW("VirtualGL extensions not found on X display. If the 3D\n"
77+
"[VGL] application uses dlopen()/dlsym() to load X11 functions, then\n"
78+
"[VGL] VirtualGL's dlopen() interposer must be preloaded.");
7779

7880
return *(bool *)extData->private_data;
7981
}
@@ -92,8 +94,10 @@ namespace faker
9294
XFindOnExtensionList(XEHeadOfExtensionList(obj), 0) ? 0 : 1;
9395
extData = XFindOnExtensionList(XEHeadOfExtensionList(obj),
9496
minExtensionNumber + 1);
95-
ERRIFNOT(extData);
96-
ERRIFNOT(extData->private_data);
97+
if(!extData || !extData->private_data)
98+
THROW("VirtualGL extensions not found on X display. If the 3D\n"
99+
"[VGL] application uses dlopen()/dlsym() to load X11 functions, then\n"
100+
"[VGL] VirtualGL's dlopen() interposer must be preloaded.");
97101

98102
return *(util::CriticalSection *)extData->private_data;
99103
}

0 commit comments

Comments
 (0)