Bug#1074389: fillets-ng: freeze during startup

Brian Raiter breadbox at muppetlabs.com
Thu Jun 27 21:20:36 BST 2024


Package: fillets-ng
Version: 1.0.1-4build2
Severity: normal

BEHAVIOR:

The program (fillets) freezes during startup, due to an unhandled
error event from the X server. The program fails to process X events
after the error, and has to be killed. The error is a X_ChangeProperty
request with a null window ID. Output from stderr:

> X Error of failed request:  BadWindow (invalid Window parameter)
>   Major opcode of failed request:  18 (X_ChangeProperty)
>   Resource id in failed request:  0x0
>   Serial number of failed request:  322
>   Current serial number in output stream:  323

ROOT CAUSE:

The program is attempting to change the window title without checking
if the window exists yet. This in itself would be no more than a
cosmetic problem, except that the code is temporarily borrowing the X
server connection from SDL (taking advantage of an advanced,
semi-documented feature of the library). SDL does not have code to
properly handle the error event that results from the unexpected
invalid request, and fails to recover properly.

FIX:

The fix is simply to add a test to avoid making the X request if the
window ID is still zero. The existing code already has a fallback for
changing the title using the standard SDL1.2 API if the X11 API is
unusable, so the window title will still get set with this change.

PATCH:

--- begin patch.txt ---
diff -u -r -x debian -x configure
fillets-ng-1.0.1/src/gengine/SysVideo.cpp
fillets-ng-1.0.1f/src/gengine/SysVideo.cpp
--- fillets-ng-1.0.1/src/gengine/SysVideo.cpp	2004-10-11
10:43:40.000000000 -0700
+++ fillets-ng-1.0.1f/src/gengine/SysVideo.cpp	2024-06-25
19:50:07.297781759 -0700
@@ -57,20 +57,22 @@
     if (info->subsystem == SDL_SYSWM_X11) {
         info->info.x11.lock_func();
 
-        XTextProperty titleprop;
-        char *text_list = const_cast<char*>(title.c_str());
-        int error =
-        Xutf8TextListToTextProperty(info->info.x11.display,
-                &text_list, 1, XUTF8StringStyle, &titleprop);
-        if (!error) {
-            XSetWMName(info->info.x11.display,
-        info->info.x11.wmwindow,
-                    &titleprop);
-            XFree(titleprop.value);
-            result = true;
-        }
-        else {
-            LOG_DEBUG(ExInfo("not supported conversion")
-                    .addInfo("error", error)
-                    .addInfo("title", title));
+        if (info->info.x11.wmwindow) {
+            XTextProperty titleprop;
+            char *text_list = const_cast<char*>(title.c_str());
+            int error =
-        Xutf8TextListToTextProperty(info->info.x11.display,
+                    &text_list, 1, XUTF8StringStyle, &titleprop);
+            if (!error) {
+                XSetWMName(info->info.x11.display,
-        info->info.x11.wmwindow,
+                        &titleprop);
+                XFree(titleprop.value);
+                result = true;
+            }
+            else {
+                LOG_DEBUG(ExInfo("not supported conversion")
+                        .addInfo("error", error)
+                        .addInfo("title", title));
+            }
         }
 
         info->info.x11.unlock_func();
---- end patch.txt ----



More information about the Pkg-games-devel mailing list