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.,
