Kdenlive crash on startup, debian + nvidia

After upgrading my debian system, kdenlive started crashing on startup. I was able to reproduce the issue on a version built from source and tracked it down to a null pointer being passed to XDisplayString (the X-Windows Display parameter). Here’s the gdb stack trace:

#0  0x00007ffff0cf51f4 in XDisplayString () at /lib/x86_64-linux-gnu/libX11.so.6
#1  0x00007fff67c05ee5 in __vaDriverInit_1_0 () at /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
#2  0x00007fffec83b24b in vaInitialize () at /lib/x86_64-linux-gnu/libva.so.2
#3  0x00007ffff224c9d8 in ??? () at /lib/x86_64-linux-gnu/libavutil.so.59
#4  0x00007ffff223e74c in av_hwdevice_ctx_create () at /lib/x86_64-linux-gnu/libavutil.so.59
#5  0x00007fffbf390a49 in ??? () at /usr/lib/x86_64-linux-gnu/qt6/plugins/multimedia/libffmpegmediaplugin.so
#6  0x00007fffbf391ec8 in ??? () at /usr/lib/x86_64-linux-gnu/qt6/plugins/multimedia/libffmpegmediaplugin.so
#7  0x00007fffbf392671 in ??? () at /usr/lib/x86_64-linux-gnu/qt6/plugins/multimedia/libffmpegmediaplugin.so
#8  0x00007fffbf396a01 in ??? () at /usr/lib/x86_64-linux-gnu/qt6/plugins/multimedia/libffmpegmediaplugin.so
#9  0x00007fffbf396e88 in ??? () at /usr/lib/x86_64-linux-gnu/qt6/plugins/multimedia/libffmpegmediaplugin.so
#10 0x00007ffff6596c81 in ??? () at /lib/x86_64-linux-gnu/libQt6Multimedia.so.6
#11 0x00007ffff6538380 in QPlatformMediaIntegration::instance() () at /lib/x86_64-linux-gnu/libQt6Multimedia.so.6
#12 0x00007ffff6564695 in QVideoSink::QVideoSink(QObject*) () at /lib/x86_64-linux-gnu/libQt6Multimedia.so.6
#13 0x00007ffff6577f61 in ??? () at /lib/x86_64-linux-gnu/libQt6Multimedia.so.6
#14 0x00007ffff6578192 in QVideoWindow::QVideoWindow(QScreen*) () at /lib/x86_64-linux-gnu/libQt6Multimedia.so.6
#15 0x00007ffff65fa447 in QVideoWidget::QVideoWidget(QWidget*) () at /lib/x86_64-linux-gnu/libQt6MultimediaWidgets.so.6
#16 0x0000555555dd7348 in PreviewPanel::PreviewPanel (this=0x55555a84dca0, parent=0x55555b7f6af0)
    at /home/mmuller/w/kdenlive/src/bin/previewpanel.cpp:42
#17 0x0000555555dcd235 in MediaBrowser::MediaBrowser (this=0x55555b7f6af0, parent=0x5555576edbb0)
    at /home/mmuller/w/kdenlive/src/bin/mediabrowser.cpp:235
#18 0x0000555555a00804 in Core::buildDocks (this=0x555556f6e1d0) at /home/mmuller/w/kdenlive/src/core.cpp:609
#19 0x0000555555a4a519 in MainWindow::init (this=0x5555576edbb0) at /home/mmuller/w/kdenlive/src/mainwindow.cpp:231
#20 0x00005555559ff05d in Core::initGUI (this=0x555556f6e1d0, MltPath=..., Url=..., clipsToLoad=...) at /home/mmuller/w/kdenlive/src/core.cpp:447
#21 0x00005555556b92ff in main (argc=1, argv=0x7fffffffe628) at /home/mmuller/w/kdenlive/src/main.cpp:541

libavutil is obtaining the display correctly, but it doesn’t look like the VA driver in nvidia_drv_video.so is using this value: it’s passing in null. I was unable to locate the source code for the nvidia library (I’m assuming it’s closed source) so I can’t tell what’s going on in it.

I was able to work around the problem by ld-preloading a shared library created from the following source:

#include <stdlib.h>
#include <X11/Xlib.h>
 
char *XDisplayString(Display *unused) {
    return getenv("DISPLAY");
}

Ran it like so:

$ gcc -shared nvid_fix.c -o nvid_fix.so
$ LD_PRELOAD=nvid_fix.so kdenlive

The program runs fine after this, so it’s likely that this is the only place this is happening.

If anyone has suggestions on how to get this fixed upstream I’d be happy to follow up.,

This is almost certainly an issue you’ll have to take up with the distro package maintainers, and not an ‘upstream’ problem. My first bet will be on things that needed to be binNMU’d for the distro update were not.

In the meantime, just use the AppImage, it’s actually being tested.

The latest AppImage (25.08.3) also crashes on startup, and it’s very likely due to the same issue.

The library passing the offending null is nvidia_drv_video.so, which is part of vdpau-va-driver which I’m fairly certain is part of the Nvidia drivers (or at least this flavor is, as I have the nvidia drivers installed).

Does it also happen with the Flatpak version? Could you test and let us know please?

It works fine for me on up to date Trixie. Are you using the proprietary nvidia drivers or something similar?

Your preload hack points to something at that end conflicting, and if the AppImage is reproducing it for you, then it’s in your system drivers because it doesn’t ship those.

I’m sorry if I’m not communicating this effectively: this is exactly my point. I’m using the proprietary nvidia driver and I think it has a bug.

frdbr: Curiously, the latest Flatpak works. Though I notice that’s at version 25.08.2 (not 25.08.3 like the AppImage)

The flatpak should be at 25.08.3 as well. Did you get it from flathub?

This is what Flathub shows when selecting Kdenlive:

Looks like Flathub still has only 25.08.2 available, or am I missing something?

I did flatpak install flathub org.kde.kdenlive, per the directions on the kdenlive site.

It seems the CI failed… Will try to find a fix.