- Timestamp:
- Sep 14, 2015 6:41:40 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
r57747 r57748 279 279 280 280 #ifdef Q_WS_X11 281 /** This is a workaround for a bug on old libX11 versions, fixed in commit 282 * 941f02ede63baa46f93ed8abccebe76fb29c0789 and released in version 1.1. */ 283 Status VBoxXInitThreads(void) 281 /** X11: For versions of Xlib which are aware of multi-threaded environments this function 282 * calls for XInitThreads() which initializes Xlib support for concurrent threads. 283 * @returns @c non-zero unless it is unsafe to make multi-threaded calls to Xlib. 284 * @remarks This is a workaround for a bug on old Xlib versions, fixed in commit 285 * 941f02e and released in Xlib version 1.1. We check for the symbol 286 * "xcb_connect" which was introduced in that version. */ 287 static Status MakeSureMultiThreadingIsSafe() 284 288 { 285 void *pvProcess = dlopen(NULL, RTLD_GLOBAL | RTLD_LAZY);289 /* Success by default: */ 286 290 Status rc = 1; 291 /* Get a global handle to process symbols: */ 292 void *pvProcess = dlopen(0, RTLD_GLOBAL | RTLD_LAZY); 293 /* Initialize multi-thread environment only if we can obtain 294 * an address of xcb_connect symbol in this process: */ 287 295 if (pvProcess && dlsym(pvProcess, "xcb_connect")) 288 296 rc = XInitThreads(); 297 /* Close the handle: */ 289 298 if (pvProcess) 290 299 dlclose(pvProcess); 300 /* Return result: */ 291 301 return rc; 292 302 } 293 #endif 303 #endif /* Q_WS_X11 */ 294 304 295 305 extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char ** /*envp*/) … … 302 312 303 313 #ifdef Q_WS_X11 304 if (! VBoxXInitThreads())314 if (!MakeSureMultiThreadingIsSafe()) 305 315 return 1; 306 316 #endif /* Q_WS_X11 */ … … 531 541 { 532 542 #ifdef Q_WS_X11 533 if (! VBoxXInitThreads())543 if (!MakeSureMultiThreadingIsSafe()) 534 544 return 1; 535 545 #endif /* Q_WS_X11 */
Note:
See TracChangeset
for help on using the changeset viewer.