Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash with segmentation fault if kwidgetsaddons 5.101.0 is installed #6587

Closed
foxB612 opened this issue Dec 15, 2022 · 17 comments · Fixed by #6612
Closed

Crash with segmentation fault if kwidgetsaddons 5.101.0 is installed #6587

foxB612 opened this issue Dec 15, 2022 · 17 comments · Fixed by #6612
Assignees

Comments

@foxB612
Copy link

foxB612 commented Dec 15, 2022

Bug Summary

If kwidgetsaddons 5.101.0 (the newest release) is installed, lmms won't launch because of a segmentation fault during preparing ui. If using gdb to skip this line, the segmentation fault won't happen.

It seems that the related workaround code is outdated and recent updates of kwidgetsaddons break it.

Platform: Arch Linux

DM&WM: sddm+i3wm

Steps to reproduce

On Arch Linux, install kwidgetsaddons-5.101 and lmms using pacman, and then launch lmms.

Expected behavior

lmms will start normally.

Actual behavior

After the splash screen, lmms crashes with a segmentation fault.

Affected LMMS versions

Reproduced on v1.2.2 and v1.3.0-alpha.1

Logs

Backtrace, though not very helpful:

Click to expand
Thread 1 "lmms" received signal SIGSEGV, Segmentation fault.
0x00007ffff688cadb in QCoreApplicationPrivate::sendThroughApplicationEventFilters (this=this@entry=0x555555956bb0, receiver=receiver@entry=0x5555560acc70, event=event@entry=0x7fffffffd540) at kernel/qcoreapplication.cpp:1172
1172	            if (obj->eventFilter(receiver, event))
(gdb) bt
#0  0x00007ffff688cadb in QCoreApplicationPrivate::sendThroughApplicationEventFilters(QObject*, QEvent*)
    (this=this@entry=0x555555956bb0, receiver=receiver@entry=0x5555560acc70, event=event@entry=0x7fffffffd540) at kernel/qcoreapplication.cpp:1172
#1  0x00007ffff7978b5a in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=0x555555956bb0, receiver=0x5555560acc70, e=0x7fffffffd540)
    at kernel/qapplication.cpp:3608
#2  0x00007ffff688cf98 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x5555560acc70, event=0x7fffffffd540)
    at kernel/qcoreapplication.cpp:1064
#3  0x00007ffff79a53fa in QWidgetPrivate::setStyle_helper(QStyle*, bool) (this=, newStyle=0x0, propagate=)
    at kernel/qwidget.cpp:2659
#4  0x00007ffff79b0405 in QWidget::setParent(QWidget*, QFlags) (this=0x5555560acc70, parent=, f=...)
    at kernel/qwidget.cpp:10501
#5  0x00007ffff799d19a in QWidgetPrivate::init(QWidget*, QFlags) (this=0x555555d41c00, parentWidget=, f=...)
    at kernel/qwidget.cpp:1046
#6  0x0000555555759513 in MainWindow::MainWindow() (this=this@entry=0x555555ce6540) at /usr/include/qt/QtCore/qflags.h:120
#7  0x000055555574ccd9 in GuiApplication::GuiApplication() (this=this@entry=0x555555a499e0)
    at /usr/src/debug/lmms/lmms-1.2.2/src/gui/GuiApplication.cpp:116
#8  0x00005555556482ca in main(int, char**) (argc=, argv=) at /usr/src/debug/lmms/lmms-1.2.2/src/core/main.cpp:759
@foxB612 foxB612 added the bug label Dec 15, 2022
@Iron-Squid
Copy link

Iron-Squid commented Dec 15, 2022

Confirming that this also occurs on my machine

@PhysSong
Copy link
Member

FYI, the upstream bug was fixed in KXmlGui 5.55.0(in this commit).

@yohannd1
Copy link

I've had the same issue and, for a temporary fix for anyone with it as well (Arch Linux): try using kwidgetsaddons 5.100.0-1 for now. I downgraded it using the downgrade program (sudo downgrade kwidgetsaddons=5.100.0-1).

@RiedleroD
Copy link
Contributor

can confirm, this workaround works on arch linux.

@Fl0wdnb
Copy link

Fl0wdnb commented Dec 18, 2022

Here is a workaround for the non-systemd Artix users: Downgrade kwidgetsaddons (5.101.0-1 => 5.92.0-1). Until the bug can be fixed, that is the only way to run the program at the given moment. If you don't have the downgrade package installed, it can be found on the AUR with "[aur helper] -S downgrade" or "cd /tmp && git clone https://aur.archlinux.org/downgrade.git && cd downgrade && makepkg -si" This was also mentioned by @YohananDiamond (I didn't notice until after I typed this up and didn't want to make this a waste of time)

@herbeeg
Copy link

herbeeg commented Dec 22, 2022

I've had the same issue and, for a temporary fix for anyone with it as well (Arch Linux): try using kwidgetsaddons 5.100.0-1 for now. I downgraded it using the downgrade program (sudo downgrade kwidgetsaddons=5.100.0-1).

Can confirm as well. This works for the time being for me. Thanks all for reporting this and temporarily allowing me to carry on producing.

@salaaad2
Copy link

salaaad2 commented Jan 13, 2023

Had this bug on fedora linux, with the native package as well as with the appimage.
Fixed by running
# dnf downgrade kf5-kwidgetsaddons

@ribbon-otter
Copy link

Is there anything I can do to speed up the fixing of this bug? I also use Kdenlive, so downgrading kwidgetsaddons don't work for me as well. I see there is a patch by voidlinux that is said to fix it. Could we merge that patch into LMMS/lmms repository?

@PhysSong PhysSong self-assigned this Jan 14, 2023
@jmfergeau
Copy link

kwidgetsaddons 5.102 arrived, still the same problem.

@dvzrv
Copy link

dvzrv commented Jan 21, 2023

@PhysSong can you please create a new release for this? Your patch does not apply cleanly on top of 1.2.2

@dvzrv
Copy link

dvzrv commented Jan 21, 2023

This is mainly due to large scale code formatting, e.g. 0b27497

@dvzrv
Copy link

dvzrv commented Jan 21, 2023

As well as this one: 7227c89

Sorry, but if you do these types of large refactorings, please do a release afterwards so that people don't have to backport patches through this kind of mess. It takes a lot of effort...

@PhysSong
Copy link
Member

@dvzrv You can use this:

diff --git a/src/gui/MainApplication.cpp b/src/gui/MainApplication.cpp
index 994ae2771..9afa20a71 100644
--- a/src/gui/MainApplication.cpp
+++ b/src/gui/MainApplication.cpp
@@ -35,6 +35,19 @@ MainApplication::MainApplication(int& argc, char** argv) :
 	QApplication(argc, argv),
 	m_queuedFile()
 {
+#if !defined(LMMS_BUILD_WIN32) && !defined(LMMS_BUILD_APPLE) && !defined(LMMS_BUILD_HAIKU) && QT_VERSION >= 0x050000
+	// Work around a bug of KXmlGui < 5.55
+	// which breaks the recent files menu
+	// https://bugs.kde.org/show_bug.cgi?id=337491
+	for (auto child : children())
+	{
+		if (child->inherits("KCheckAcceleratorsInitializer"))
+		{
+			delete child;
+		}
+	}
+#endif
+
 #if defined(LMMS_BUILD_WIN32) && QT_VERSION >= 0x050000
 	installNativeEventFilter(this);
 #endif
diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp
index e6971f96d..26532eb5b 100644
--- a/src/gui/MainWindow.cpp
+++ b/src/gui/MainWindow.cpp
@@ -33,7 +33,6 @@
 #include <QMenuBar>
 #include <QMessageBox>
 #include <QShortcut>
-#include <QLibrary>
 #include <QSplitter>
 #include <QUrl>
 #include <QWhatsThis>
@@ -65,21 +64,6 @@
 
 #include "lmmsversion.h"
 
-#if !defined(LMMS_BUILD_WIN32) && !defined(LMMS_BUILD_APPLE) && !defined(LMMS_BUILD_HAIKU) && QT_VERSION >= 0x050000
-//Work around an issue on KDE5 as per https://bugs.kde.org/show_bug.cgi?id=337491#c21
-void disableAutoKeyAccelerators(QWidget* mainWindow)
-{
-	using DisablerFunc = void(*)(QWidget*);
-	QLibrary kf5WidgetsAddon("KF5WidgetsAddons", 5);
-	DisablerFunc setNoAccelerators = 
-			reinterpret_cast<DisablerFunc>(kf5WidgetsAddon.resolve("_ZN19KAcceleratorManager10setNoAccelEP7QWidget"));
-	if(setNoAccelerators)
-	{
-		setNoAccelerators(mainWindow);
-	}
-	kf5WidgetsAddon.unload();
-}
-#endif
 
 
 MainWindow::MainWindow() :
@@ -92,9 +76,6 @@ MainWindow::MainWindow() :
 	m_metronomeToggle( 0 ),
 	m_session( Normal )
 {
-#if !defined(LMMS_BUILD_WIN32) && !defined(LMMS_BUILD_APPLE) && !defined(LMMS_BUILD_HAIKU) && QT_VERSION >= 0x050000
-	disableAutoKeyAccelerators(this);
-#endif
 	setAttribute( Qt::WA_DeleteOnClose );
 
 	QWidget * main_widget = new QWidget( this );

@dvzrv
Copy link

dvzrv commented Jan 21, 2023

@dvzrv You can use this:

No, I can not. It does not apply cleanly on top of 1.2.2 and I have to backport this (see my earlier comments).

@PhysSong
Copy link
Member

@dvzrv It is the backported version. I can git apply this on top of 1.2.2.

@dvzrv
Copy link

dvzrv commented Jan 21, 2023

Alright, thank you. I'll use that then.
Generally, doing the code refactorings and no release will make this much harder for downstreams to apply (unless someone asks). Please consider making a release.

@salaaad2
Copy link

salaaad2 commented Jun 7, 2023

Still happens on the fedora 37 release (both dnf and flatpak), use sudo yum downgrade kf5-kwidgetsaddons to downgrade the package :).

freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this issue Jun 17, 2023
Add temporary patch to fix a crash at startup if kwidgetsaddons
5.101.0 is installed. The patch was obtained from LMMS ticket
related with this issue[1].

[1] LMMS/lmms#6587

Since I'm here reorder Makefile to make linters happy.

PR:		270470
Reported by:	Manuel <[email protected]>
MFH:	    2023Q2
freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this issue Jun 17, 2023
Add temporary patch to fix a crash at startup if kwidgetsaddons
5.101.0 is installed. The patch was obtained from LMMS ticket
related with this issue[1].

[1] LMMS/lmms#6587

Since I'm here reorder Makefile to make linters happy.

PR:		270470
Reported by:	Manuel <[email protected]>
MFH:	    2023Q2

(cherry picked from commit 8827164)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.