From f64b87a5df8870be138dbf3febad950e1fc4ed8c Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 18 Mar 2015 10:03:36 +0100 Subject: [PATCH] Fallback to malloc for insanely large windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Jørgen Lind --- src/plugins/platforms/xcb/qxcbbackingstore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index f4382c7b50..42a868d997 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -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);