Fix fatal X11 errors when both external display and command arguments are provided to QApplication

This resolves Bug 1456
(cherry picked from commit 7abfc2a181)
v3.5.13-sru
Timothy Pearson 11 years ago committed by Slávek Banko
parent 045b2d9ad8
commit e7d0f7dba5

@ -1790,18 +1790,26 @@ void qt_init_internal( int *argcptr, char **argv,
}
}
#endif
// Connect to X server
if( qt_is_gui_used ) {
if ( ( appDpy = XOpenDisplay(appDpyName) ) == 0 ) {
qWarning( "%s: cannot connect to X server %s", appName,
XDisplayName(appDpyName) );
qApp = 0;
exit( 1 );
}
if ( display ) {
// Display connection already opened by another application
if ( appSync ) // if "-sync" argument
XSynchronize( appDpy, TRUE );
appForeignDpy = TRUE;
appDpy = display;
}
else {
// Connect to X server
if( qt_is_gui_used ) {
if ( ( appDpy = XOpenDisplay(appDpyName) ) == 0 ) {
qWarning( "%s: cannot connect to X server %s", appName,
XDisplayName(appDpyName) );
qApp = 0;
exit( 1 );
}
if ( appSync ) // if "-sync" argument
XSynchronize( appDpy, TRUE );
}
}
}
// Common code, regardless of whether display is foreign.

Loading…
Cancel
Save