From 69a682ce34a9660cfaad5112682972d4a3e0b40a Mon Sep 17 00:00:00 2001 From: Nikos Tsipinakis Date: Wed, 19 Jun 2019 10:55:23 +0300 Subject: [PATCH] Fix call to draw when no notifications are available Draw should not be called when there are no notifications in the queue. This for unknown reasons causes a crash the next time we attempt to get the currently active window with a BadValue error from XGetWindowProperty. Fixes #630. --- src/draw.c | 1 + src/x11/x.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/draw.c b/src/draw.c index 7dbe55f..80468b5 100644 --- a/src/draw.c +++ b/src/draw.c @@ -611,6 +611,7 @@ static void calc_window_pos(int width, int height, int *ret_x, int *ret_y) void draw(void) { + assert(queues_length_displayed() > 0); GSList *layouts = create_layouts(x_win_get_context(win)); diff --git a/src/x11/x.c b/src/x11/x.c index e5f8177..5606762 100644 --- a/src/x11/x.c +++ b/src/x11/x.c @@ -341,7 +341,10 @@ gboolean x_mainloop_fd_dispatch(GSource *source, GSourceFunc callback, gpointer LOG_D("XEvent: processing PropertyNotify for Resource manager"); XRM_update_db(); screen_dpi_xft_cache_purge(); - draw(); + + if (win->visible) { + draw(); + } break; } /* Explicitly fallthrough. Other PropertyNotify events, e.g. catching