From ac8070287eaebf9b1e4d60a50e0ae7aa3cd763d4 Mon Sep 17 00:00:00 2001 From: m0dB <79429057+m0dB@users.noreply.github.com> Date: Mon, 3 Oct 2022 10:36:21 +0200 Subject: [PATCH 1/2] made vumetergl the default and simplified commandline option to disable it --- src/util/cmdlineargs.cpp | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/src/util/cmdlineargs.cpp b/src/util/cmdlineargs.cpp index ebe4b5e85ccc..b643174b9fa1 100644 --- a/src/util/cmdlineargs.cpp +++ b/src/util/cmdlineargs.cpp @@ -9,27 +9,12 @@ #include "sources/soundsourceproxy.h" #include "util/versionstore.h" -namespace { -bool useVuMeterGLDefault() { - // The QGLWidget derived WVuMeterGL provided better performance, - // particularly on macOS, but on linux with older Qt versions - // (tested with 5.12.3) we have segfaults as Qt seems to still - // be accessing the QGLWidget after deletion, when switching - // skins or on exit. -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 3) || defined(__APPLE__) - return true; -#else - return false; -#endif -} -} // namespace - CmdlineArgs::CmdlineArgs() : m_startInFullscreen(false), // Initialize vars m_midiDebug(false), m_developer(false), m_safeMode(false), - m_useVuMeterGL(useVuMeterGLDefault()), + m_useVuMeterGL(true), m_debugAssertBreak(false), m_settingsPathSet(false), m_logLevel(mixxx::kLogLevelDefault), @@ -113,12 +98,9 @@ warnings and errors to the console unless this is set properly.\n", stdout); when a critical error occurs unless this is set properly.\n", stdout); } i++; - } else if (argv[i] == QString("--useVuMeterGL")) { - QString qs(i + 1 < argc ? argv[i + 1] : ""); - if (qs != "yes" && qs != "no") { - fputs("\nExpected yes or no after --useVuMeterGL\n", stdout); - } - m_useVuMeterGL = (qs == "yes"); + } else if (QString::fromLocal8Bit(argv[i]).contains( + "--disableVuMeterGL", Qt::CaseInsensitive)) { + m_useVuMeterGL = false; } else if (QString::fromLocal8Bit(argv[i]).contains( "--midiDebug", Qt::CaseInsensitive) || QString::fromLocal8Bit(argv[i]).contains( @@ -178,14 +160,8 @@ void CmdlineArgs::printUsage() { --safeMode Enables safe-mode. Disables OpenGL waveforms,\n\ and spinning vinyl widgets. Try this option if\n\ Mixxx is crashing on startup.\n\ -\n", - stdout); - fprintf(stdout, - "\ ---useVuMeterGL yes|no Use OpenGL VuMeter instead of standard.\n\ - Default for your configuration is: %s\n", - (m_useVuMeterGL ? "yes" : "no")); - fputs("\ +\n\ +--disableVuMeterGL Do not use OpenGL vu meter.\n\ \n\ --locale LOCALE Use a custom locale for loading translations\n\ (e.g 'fr')\n\ From b8dff320982216317dc6811183bc55bcb57da21f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Mon, 3 Oct 2022 21:19:09 +0200 Subject: [PATCH 2/2] Apply the GL widget workaround only for the x11 (xcb) platform --- src/skin/legacy/legacyskinparser.cpp | 30 ++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/skin/legacy/legacyskinparser.cpp b/src/skin/legacy/legacyskinparser.cpp index f794b2b41eb5..3da36b6e51d0 100644 --- a/src/skin/legacy/legacyskinparser.cpp +++ b/src/skin/legacy/legacyskinparser.cpp @@ -1269,14 +1269,19 @@ QWidget* LegacySkinParser::parseSpinny(const QDomElement& node) { SKIN_WARNING(node, *m_pContext) << "No player found for group:" << group; return nullptr; } - // Note: For some reasons we need to create the widget without a parent to avoid to - // create two platform windows in QWidget::create() for this widget. + // Note: For some reasons on X11 we need to create the widget without a parent to avoid to + // create two platform windows (QXcbWindow) in QWidget::create() for this widget. // This happens, because the QWidget::create() of a parent() will populate all children // with platform windows q_createNativeChildrenAndSetParent() while another window is already // under construction. The ID for the first window is not cleared and leads to a segfault - // during on shutdown - WSpinny* pSpinny = new WSpinny(nullptr, group, m_pConfig, m_pVCManager, pPlayer); - pSpinny->setParent(m_pParent); + // during on shutdown. This has been tested with Qt 5.12.8 and 5.15.3 + WSpinny* pSpinny; + if (qApp->platformName() == QLatin1String("xcb")) { + pSpinny = new WSpinny(nullptr, group, m_pConfig, m_pVCManager, pPlayer); + pSpinny->setParent(m_pParent); + } else { + pSpinny = new WSpinny(m_pParent, group, m_pConfig, m_pVCManager, pPlayer); + } commonWidgetSetup(node, pSpinny); connect(waveformWidgetFactory, @@ -1319,14 +1324,19 @@ QWidget* LegacySkinParser::parseVuMeter(const QDomElement& node) { dummy->setText(tr("No OpenGL\nsupport.")); return dummy; } - // Note: For some reasons we need to create the widget without a parent to avoid to - // create two platform windows in QWidget::create() for this widget. + // Note: For some reasons on X11 we need to create the widget without a parent to avoid to + // create two platform windows (QXcbWindow) in QWidget::create() for this widget. // This happens, because the QWidget::create() of a parent() will populate all children // with platform windows q_createNativeChildrenAndSetParent() while another window is already // under construction. The ID for the first window is not cleared and leads to a segfault - // during on shutdown - WVuMeterGL* pVuMeterWidget = new WVuMeterGL(); - pVuMeterWidget->setParent(m_pParent); + // during on shutdown. This has been tested with Qt 5.12.8 and 5.15.3 + WVuMeterGL* pVuMeterWidget; + if (qApp->platformName() == QLatin1String("xcb")) { + pVuMeterWidget = new WVuMeterGL(); + pVuMeterWidget->setParent(m_pParent); + } else { + pVuMeterWidget = new WVuMeterGL(m_pParent); + } commonWidgetSetup(node, pVuMeterWidget); waveformWidgetFactory->addVuMeter(pVuMeterWidget);