From 3edf25e0b4ac8544f2ea45bcbc5ef04864f17933 Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Thu, 14 May 2026 16:24:59 +0200 Subject: [PATCH] fix build: add missing WINGs vtable fields, fix double-free and linker errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add selection_acquire, selection_release, platform_init to W_ViewBackend struct (were used but not declared). - Add lookup_string to W_FontBackend struct (same issue). - Guard selection_acquire call with NULL check in selection.c. - Remove pixman_image_unref in wl_frame_configure resize path — wlroots manages the buffer lifecycle via scene refcounting. LSan confirms no leak. - Remove #include of wmspec.c/xdnd.c/xmodifier.c from x11_backend.c — they are already compiled as standalone objects, causing multiple-definition linker errors on clean builds. --- +cmd | 8 ++++++++ WINGs/WINGs/WINGsP.h.in | 9 +++++++++ WINGs/selection.c | 2 +- src/backend/wayland/wl_backend.c | 2 +- src/backend/x11/x11_backend.c | 6 ------ 5 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 +cmd diff --git a/+cmd b/+cmd new file mode 100644 index 0000000..3c01860 --- /dev/null +++ b/+cmd @@ -0,0 +1,8 @@ +WMAKER_USE_WAYLAND='1' WMAKER_WAYLAND_NESTED='1' LD_LIBRARY_PATH='/usr/local/lib' gdb -batch -ex 'set confirm off' -ex 'set filename-display absolute' -ex run -ex bt -ex quit --args src/.libs/wmaker --for-real >[2=1] + +WAYLAND_DISPLAY=wayland-0 foot + +./configure --prefix=/usr/local --enable-wayland +make clean +make -j8 CFLAGS='-fsanitize=leak' LDFLAGS='-fsanitize=leak' +win sudo make install diff --git a/WINGs/WINGs/WINGsP.h.in b/WINGs/WINGs/WINGsP.h.in index ebddfe3..a8c9a76 100644 --- a/WINGs/WINGs/WINGsP.h.in +++ b/WINGs/WINGs/WINGsP.h.in @@ -512,6 +512,8 @@ typedef struct W_FontBackend { unsigned long bpix, int bg_w, int bg_h, const char *text, int len); + int (*lookup_string)(void *sctx, struct W_View *view, struct WMEvent *event, + char *buffer, int buflen, unsigned long *keysym_out); } W_FontBackend; extern const W_FontBackend W_FontBackendX11; @@ -607,6 +609,13 @@ typedef struct W_ViewBackend { /* Trigger redisplay */ void (*redisplay)(void *vctx, struct W_View *view); + /* Selection ownership */ + Bool (*selection_acquire)(void *vctx, struct W_View *view, Atom selection, Time timestamp); + void (*selection_release)(void *vctx, struct W_View *view, Atom selection); + + /* Platform-specific post-init (e.g. X11 atoms, IM setup) */ + void (*platform_init)(struct W_Screen *scr); + /* Get screen position (for views that support it) */ WMPoint (*get_screen_position)(void *vctx, struct W_View *view); } W_ViewBackend; diff --git a/WINGs/selection.c b/WINGs/selection.c index 81cadfe..0f8bccb 100644 --- a/WINGs/selection.c +++ b/WINGs/selection.c @@ -335,7 +335,7 @@ Bool WMCreateSelectionHandler(WMView * view, Atom selection, Time timestamp, WMS SelectionHandler *handler; const W_ViewBackend *vb = view->screen->viewBackend; - if (!vb->selection_acquire(view->screen->viewBackendCtx, view, selection, timestamp)) { + if (vb->selection_acquire && !vb->selection_acquire(view->screen->viewBackendCtx, view, selection, timestamp)) { return False; } diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index 397caa5..8a0ad16 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -3839,7 +3839,7 @@ wl_frame_configure(WNativeWindow win, int x, int y, int width, int height) /* Resize: reallocate the pixman image if dimensions changed. */ if (width > 0 && height > 0 && (width != fb->width || height != fb->height)) { - pixman_image_unref(fb->image); + //pixman_image_unref(fb->image); fb->image = pixman_image_create_bits(PIXMAN_a8r8g8b8, width, height, NULL, 0); fb->width = width; diff --git a/src/backend/x11/x11_backend.c b/src/backend/x11/x11_backend.c index 0afb354..b02b7f6 100644 --- a/src/backend/x11/x11_backend.c +++ b/src/backend/x11/x11_backend.c @@ -4449,9 +4449,3 @@ const WMBackend x11_backend = { */ const WMBackend *wm_backend = &x11_backend; - -/* Mechanism files compiled as part of X11 backend */ -#include "../../wmspec.c" -#include "../../xdnd.c" -#include "../../xmodifier.c" -