Fallback to malloc for insanely large windows

If shmget() does not work (probably because the backingstore size is
bigger than SHMMAX), don't create a QImage with the previous buffer and
the new size. That does not end well when we try to draw to the image
later. Instead, fall back to the malloc path, like we do when the system
doesn't support shared memory.

[ChangeLog][X11] Don't crash when resizing windows to bigger than 3840x2160

Task-number: QTBUG-45071
Change-Id: I009de7c2179ffde28e252593067756877cad1b1c
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
This commit is contained in:
Paul Olav Tvete 2015-03-18 10:03:36 +01:00
parent 45a0629a95
commit f64b87a5df

View File

@ -122,7 +122,7 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QI
xcb_generic_error_t *error = NULL;
if (shm_present)
error = xcb_request_check(xcb_connection(), xcb_shm_attach_checked(xcb_connection(), m_shm_info.shmseg, m_shm_info.shmid, false));
if (!shm_present || error) {
if (!shm_present || error || id == -1) {
free(error);
shmdt(m_shm_info.shmaddr);