# HG changeset patch # User Paper # Date 1713827466 14400 # Node ID fac204fb374884272b11ac526e8f383ffe7dc82b # Parent 87841727fa47069f633f9f45cb2f93ebda3d0cc3 dep/animone: x11: correctly check for connection failure if there's no X server running then the previous code segfaults(!) diff -r 87841727fa47 -r fac204fb3748 src/win/x11.cc --- a/src/win/x11.cc Thu Apr 18 16:51:35 2024 -0400 +++ b/src/win/x11.cc Mon Apr 22 19:11:06 2024 -0400 @@ -11,6 +11,7 @@ #include #include #include +#include #include @@ -156,7 +157,7 @@ return false; xcb_connection_t* connection = ::xcb_connect(NULL, NULL); - if (!connection) + if (xcb_connection_has_error(connection)) return false; std::set windows; @@ -168,7 +169,7 @@ roots.push_back(iter.data->root); } - if (!GetAllTopLevelWindowsEWMH(connection, roots, windows)) + //if (!GetAllTopLevelWindowsEWMH(connection, roots, windows)) GetAllTopLevelWindowsICCCM(connection, roots, windows); }