[PATCH 0/2] wmsetbg: fix "X connection broken" crash when changing background

14 views
Skip to first unread message

Haroldo Santos

unread,
Jun 15, 2026, 11:53:51 AMJun 15
to Window Maker Development

Hi,

This small series fixes a crash in wmsetbg that shows up when setting
a background from the menu or command line:

  X connection to :0 broken (explicit kill or server shutdown).

The root cause is in setPixmapProperty(): it called XKillClient() to
free the previous background pixmap stored in _XROOTPMAP_ID.  The
pixmap was created via a short-lived second X connection using
RetainPermanent.  The X server reuses client IDs after connections
close; if wmsetbg's own connection later received the same recycled ID
as the stored pixmap, XKillClient() would kill its own connection.

The fix is to switch to RetainTemporary: background pixmaps live for
the duration of the X session and are freed automatically at logout,
so no explicit XKillClient() is required.

Tested on a dual-monitor setup (1920x1200 + 2560x1440, Xinerama
active) where the crash was 100% reproducible before this series.

 Haroldo Santos (2):
   wmsetbg: fix memory leak of XGetWindowProperty data in setPixmapProperty
   wmsetbg: fix "X connection broken" crash when setting background

  util/wmsetbg.c | 2 ++
  1 file changed, 2 insertions(+)

  util/wmsetbg.c | 39 ++++++++++++++++-----------------------
  1 file changed, 16 insertions(+), 23 deletions(-)


--
=============================================================
Haroldo Gambini Santos
email: haroldo.santos [at ] gmail.com 
home/research page: www.decom.ufop.br/haroldo (outdated)
0001-wmsetbg-fix-memory-leak-of-XGetWindowProperty-data-i.patch
0002-wmsetbg-fix-X-connection-broken-crash-when-setting-b.patch
Reply all
Reply to author
Forward
0 new messages