summaryrefslogtreecommitdiff
path: root/platform/x11
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-05-01 10:08:50 +0200
committerGitHub <noreply@github.com>2019-05-01 10:08:50 +0200
commit48d31632a5f794f578879c80ab1bc5bcd44c1092 (patch)
tree5301574334a69e72035580b6ea40ea3c3f37bbab /platform/x11
parent59b553b2af958b6fba019f8fb78326053039b2d3 (diff)
parent2684e816823ef3911143e630f92bc969adece1b5 (diff)
Merge pull request #28557 from AndreaCatania/revfix
Fixed game crash, regression of #26977
Diffstat (limited to 'platform/x11')
-rw-r--r--platform/x11/os_x11.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 5a3d3acb12..d5ca3742db 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -1190,9 +1190,12 @@ void OS_X11::set_window_position(const Point2 &p_position) {
unsigned long remaining;
unsigned char *data = NULL;
if (XGetWindowProperty(x11_display, x11_window, prop, 0, 4, False, AnyPropertyType, &type, &format, &len, &remaining, &data) == Success) {
- long *extents = (long *)data;
- x = extents[0];
- y = extents[2];
+ if (format == 32 && len == 4) {
+ long *extents = (long *)data;
+ x = extents[0];
+ y = extents[2];
+ }
+ XFree(data);
}
}
XMoveWindow(x11_display, x11_window, p_position.x - x, p_position.y - y);
@@ -1218,9 +1221,12 @@ Size2 OS_X11::get_real_window_size() const {
unsigned long remaining;
unsigned char *data = NULL;
if (XGetWindowProperty(x11_display, x11_window, prop, 0, 4, False, AnyPropertyType, &type, &format, &len, &remaining, &data) == Success) {
- long *extents = (long *)data;
- w += extents[0] + extents[1]; // left, right
- h += extents[2] + extents[3]; // top, bottom
+ if (format == 32 && len == 4) {
+ long *extents = (long *)data;
+ w += extents[0] + extents[1]; // left, right
+ h += extents[2] + extents[3]; // top, bottom
+ }
+ XFree(data);
}
return Size2(w, h);
}