Workaround X11 configuration which return inconsistent settings

Some X11 configurations,  return inconsistent values for DefaultScreen and
ScreenCount, which may result in access to memory beyound allocated
value.

An example of such configuration may be the proprietary nvidia driver in
non-TwinView multiscreen mode (which is known a Zaphod Mode in OSS
drivers) on the second display defaultScreen=1, but screenCount is only
1 as well.

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
pull/134/head
Alexander Golubev 2 months ago
parent b1e6f38464
commit 42cf5f6f2c

@ -138,6 +138,9 @@ void TQDesktopWidgetPrivate::init()
{
defaultScreen = DefaultScreen(TQPaintDevice::x11AppDisplay());
newScreenCount = ScreenCount(TQPaintDevice::x11AppDisplay());
// Some configurations may return inconsistent data for this values
if ( defaultScreen < 0 || defaultScreen >= screenCount )
defaultScreen = 0;
use_xinerama = false;
}

Loading…
Cancel
Save