Skip to content

Commit 562c737

Browse files
authored
Fix segfault when out_to_x = false. (#455)
This resolves #454.
1 parent abd0be5 commit 562c737

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

‎src/conky.cc‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2076,20 +2076,24 @@ static void main_loop(void)
20762076
sigaddset(&newmask, SIGUSR1);
20772077
#endif
20782078

2079+
#ifdef BUILD_X11
20792080
#ifdef BUILD_XSHAPE
2080-
/* allow only decorated windows to be given mouse input */
2081-
int major_version, minor_version;
2082-
if (!XShapeQueryVersion(display, &major_version, &minor_version)) {
2083-
NORM_ERR("Input shapes are not supported");
2084-
} else {
2085-
if (own_window.get(*state) &&
2086-
(own_window_type.get(*state) != TYPE_NORMAL ||
2087-
(TEST_HINT(own_window_hints.get(*state), HINT_UNDECORATED)))) {
2088-
XShapeCombineRectangles(display, window.window, ShapeInput, 0, 0,
2089-
NULL, 0, ShapeSet, Unsorted);
2081+
if (out_to_x.get(*state)) {
2082+
/* allow only decorated windows to be given mouse input */
2083+
int major_version, minor_version;
2084+
if (!XShapeQueryVersion(display, &major_version, &minor_version)) {
2085+
NORM_ERR("Input shapes are not supported");
2086+
} else {
2087+
if (own_window.get(*state) &&
2088+
(own_window_type.get(*state) != TYPE_NORMAL ||
2089+
(TEST_HINT(own_window_hints.get(*state), HINT_UNDECORATED)))) {
2090+
XShapeCombineRectangles(display, window.window, ShapeInput, 0, 0,
2091+
NULL, 0, ShapeSet, Unsorted);
2092+
}
20902093
}
20912094
}
20922095
#endif /* BUILD_XSHAPE */
2096+
#endif /* BUILD_X11 */
20932097

20942098
last_update_time = 0.0;
20952099
next_update_time = get_time() - fmod(get_time(), active_update_interval());

0 commit comments

Comments
 (0)