DeaDBeeF-Player / deadbeef

DeaDBeeF Player
https://deadbeef.sourceforge.io/
Other
1.65k stars 179 forks source link

Crash opening Preferences when path contains "\bin\" on Windows #3024

Closed bipface closed 1 year ago

bipface commented 1 year ago

Steps to reproduce the problem

Only seems to occur when the GTK3 UI is active, GTK2 is unaffected.

Subfolders nested in any manner can trigger the issue (e.g. c:\foo\bin\bar\deadbeef-x86_64\...) so long as one of the components is named exactly "bin" (case-insensitive).

Deadbeef version: 1.9.6 or the current 'devel' version at time of writing. OS: Windows 10 version 19045.3570

Details in Event Viewer:

Faulting application name: deadbeef.exe, version: 1.0.0.0, time stamp: 0x654a8032
Faulting module name: libglib-2.0-0.dll, version: 2.78.1.0, time stamp: 0x65395fba
Exception code: 0x40000015
Fault offset: 0x00000000000b9be5
Faulting process ID: 0x18f4
Faulting application start time: 0x01da2a7765669a37
Faulting application path: C:\bin\deadbeef-x86_64\deadbeef.exe
Faulting module path: C:\bin\deadbeef-x86_64\libglib-2.0-0.dll
Report ID: 280201c5-e3b1-4f17-80cc-f3a6319d224a
Faulting package full name: 
Faulting package-relative application ID: 

UI with missing button icons: Untitled

kuba160 commented 1 year ago

I was affected by this bug multiple times but never knew that bin is the problem (premake compiles deadbeef to bin/debug or bin/release by default). Why it doesn't work? gdk (in this case) has external loaders to load icons (separate loaders for diff. image formats) and they are located in the lib folder. When having bin in the path glib expects to find the lib folder in the same folder as the bin folder. Moving lib folder 'fixes' the icon problem but the problem will persist in other areas (such as icon packs, themes and maybe more). I tried several gtk environment variables (GTK_EXE_PREFIX, GTK_DATA_PREFIX, GDK_PIXBUF_MODULE_FILE, ...) but I couldn't find the right solution for the problem. 😟

Oleksiy-Yakovenko commented 1 year ago

sounds like a gdk/glib limitation, should we close this as unfixable?

kuba160 commented 1 year ago

It might be possible to fix, either by the environment variables (I have no idea how), or by maybe restructuring deadbeef folder structure. Also possible that somebody more experienced will come up with other solution. It's hard for me to debug gtk related stuff and I couldn't find anything useful on the internet related to the issue (typical for me when looking up gtk stuff).

Oleksiy-Yakovenko commented 1 year ago

Looks like the relevant code is here: https://github.com/GNOME/gdk-pixbuf/blob/master/gdk-pixbuf/queryloaders.c#L335

Oleksiy-Yakovenko commented 1 year ago

Maybe the relevant function: https://github.com/GNOME/glib/blob/main/glib/gwin32.c#L274

Oleksiy-Yakovenko commented 1 year ago

If that directory's last component is "bin" or "lib", its parent directory is returned, otherwise the directory itself.

Oleksiy-Yakovenko commented 1 year ago

Seems like it is hardcoded, and it expects certain directory structure when installed under bin or lib folder, so it still seems quite unfixable to me without patching glib. There's an easy workaround though, so I don't see any big reason to keep it open.

opus-x commented 8 months ago

Below is an option you can try (source) for DeaDBeeF version 1.9.6. Note you need the offset I used. I'm happy now. 😄

Load libglib-2.0-0.dll (version 2.78.1.0) into a hex editor, find the "bin" at around offset 0x129605, and change that "bin" to something else (that does not exist in the path).

@bipface