forked from quickshell/quickshell
		
	crash: print warning messages for run/buildtime Qt version mismatch
This commit is contained in:
		
							parent
							
								
									89d04f34a5
								
							
						
					
					
						commit
						4c2d7a7e41
					
				
					 4 changed files with 57 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -67,6 +67,11 @@ It is not managed by us and should be looked over before use.
 | 
			
		|||
 | 
			
		||||
[AUR package]: https://aur.archlinux.org/packages/quickshell
 | 
			
		||||
 | 
			
		||||
> [!CAUTION]
 | 
			
		||||
> The AUR provides no way to force the quickshell package to rebuild when the Qt version changes.
 | 
			
		||||
> If you experience crashes after updating Qt, please try rebuilding Quickshell against the
 | 
			
		||||
> current Qt version before opening an issue.
 | 
			
		||||
 | 
			
		||||
## Fedora (COPR)
 | 
			
		||||
Quickshell has a third party [Fedora COPR package] available under the same name.
 | 
			
		||||
It is not managed by us and should be looked over before use.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,7 @@
 | 
			
		|||
#include <cerrno>
 | 
			
		||||
#include <cstdio>
 | 
			
		||||
#include <cstdlib>
 | 
			
		||||
#include <cstring>
 | 
			
		||||
#include <limits>
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <vector>
 | 
			
		||||
| 
						 | 
				
			
			@ -176,6 +177,7 @@ struct CommandState {
 | 
			
		|||
	} subcommand;
 | 
			
		||||
 | 
			
		||||
	struct {
 | 
			
		||||
		bool checkCompat = false;
 | 
			
		||||
		bool printVersion = false;
 | 
			
		||||
		bool killAll = false;
 | 
			
		||||
		bool noDuplicate = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -290,6 +292,8 @@ int runCommand(int argc, char** argv, QCoreApplication* coreApplication) {
 | 
			
		|||
	addDebugOptions(&cli);
 | 
			
		||||
 | 
			
		||||
	{
 | 
			
		||||
		cli.add_option_group("")->add_flag("--private-check-compat", state.misc.checkCompat);
 | 
			
		||||
 | 
			
		||||
		cli.add_flag("-V,--version", state.misc.printVersion)
 | 
			
		||||
		    ->description("Print quickshell's version and exit.");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -378,6 +382,18 @@ int runCommand(int argc, char** argv, QCoreApplication* coreApplication) {
 | 
			
		|||
 | 
			
		||||
	CLI11_PARSE(cli, argc, argv);
 | 
			
		||||
 | 
			
		||||
	if (state.misc.checkCompat) {
 | 
			
		||||
		if (strcmp(qVersion(), QT_VERSION_STR) != 0) {
 | 
			
		||||
			QTextStream(stdout) << "\033[31mCOMPATIBILITY WARNING: Quickshell was built against Qt "
 | 
			
		||||
			                    << QT_VERSION_STR << " but the system has updated to Qt " << qVersion()
 | 
			
		||||
			                    << " without rebuilding the package. This is likely to cause crashes, so "
 | 
			
		||||
			                       "you must rebuild the quickshell package.\n";
 | 
			
		||||
			return 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Has to happen before extra threads are spawned.
 | 
			
		||||
	if (state.misc.daemonize) {
 | 
			
		||||
		auto closepipes = std::array<int, 2>();
 | 
			
		||||
| 
						 | 
				
			
			@ -451,6 +467,13 @@ int runCommand(int argc, char** argv, QCoreApplication* coreApplication) {
 | 
			
		|||
	} else if (*state.subcommand.msg) {
 | 
			
		||||
		return msgInstance(state);
 | 
			
		||||
	} else {
 | 
			
		||||
		if (strcmp(qVersion(), QT_VERSION_STR) != 0) {
 | 
			
		||||
			qWarning() << "\033[31mQuickshell was built against Qt" << QT_VERSION_STR
 | 
			
		||||
			           << "but the system has updated to Qt" << qVersion()
 | 
			
		||||
			           << "without rebuilding the package. This is likely to cause crashes, so "
 | 
			
		||||
			              "the quickshell package must be rebuilt.\n";
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return launchFromCommand(state, coreApplication);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,8 +1,10 @@
 | 
			
		|||
#include "interface.hpp"
 | 
			
		||||
#include <cstring>
 | 
			
		||||
#include <utility>
 | 
			
		||||
 | 
			
		||||
#include <qapplication.h>
 | 
			
		||||
#include <qboxlayout.h>
 | 
			
		||||
#include <qconfig.h>
 | 
			
		||||
#include <qdesktopservices.h>
 | 
			
		||||
#include <qfont.h>
 | 
			
		||||
#include <qfontinfo.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -10,6 +12,7 @@
 | 
			
		|||
#include <qnamespace.h>
 | 
			
		||||
#include <qobject.h>
 | 
			
		||||
#include <qpushbutton.h>
 | 
			
		||||
#include <qtversion.h>
 | 
			
		||||
#include <qwidget.h>
 | 
			
		||||
 | 
			
		||||
#include "build.hpp"
 | 
			
		||||
| 
						 | 
				
			
			@ -37,20 +40,40 @@ CrashReporterGui::CrashReporterGui(QString reportFolder, int pid)
 | 
			
		|||
 | 
			
		||||
	auto* mainLayout = new QVBoxLayout(this);
 | 
			
		||||
 | 
			
		||||
	mainLayout->addWidget(new QLabel(
 | 
			
		||||
	    "<u>Quickshell has crashed. Please submit a bug report to help us fix it.</u>",
 | 
			
		||||
	    this
 | 
			
		||||
	));
 | 
			
		||||
	auto qtVersionMatches = strcmp(qVersion(), QT_VERSION_STR) == 0;
 | 
			
		||||
	if (qtVersionMatches) {
 | 
			
		||||
		mainLayout->addWidget(new QLabel(
 | 
			
		||||
		    "<u>Quickshell has crashed. Please submit a bug report to help us fix it.</u>",
 | 
			
		||||
		    this
 | 
			
		||||
		));
 | 
			
		||||
	} else {
 | 
			
		||||
		mainLayout->addWidget(
 | 
			
		||||
		    new QLabel("<u>Quickshell has crashed, likely due to a Qt version mismatch.</u>", this)
 | 
			
		||||
		);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	mainLayout->addSpacing(textHeight);
 | 
			
		||||
 | 
			
		||||
	mainLayout->addWidget(new QLabel("General information", this));
 | 
			
		||||
	mainLayout->addWidget(new ReportLabel("Git Revision:", GIT_REVISION, this));
 | 
			
		||||
	mainLayout->addWidget(new QLabel(
 | 
			
		||||
	    QString::fromLatin1("Runtime Qt version: ") % qVersion() % ", Buildtime Qt version: "
 | 
			
		||||
	        % QT_VERSION_STR,
 | 
			
		||||
	    this
 | 
			
		||||
	));
 | 
			
		||||
	mainLayout->addWidget(new ReportLabel("Crashed process ID:", QString::number(pid), this));
 | 
			
		||||
	mainLayout->addWidget(new ReportLabel("Crash report folder:", this->reportFolder, this));
 | 
			
		||||
	mainLayout->addSpacing(textHeight);
 | 
			
		||||
 | 
			
		||||
	mainLayout->addWidget(new QLabel("Please open a bug report for this issue via github or email."));
 | 
			
		||||
	if (qtVersionMatches) {
 | 
			
		||||
		mainLayout->addWidget(new QLabel("Please open a bug report for this issue via github or email.")
 | 
			
		||||
		);
 | 
			
		||||
	} else {
 | 
			
		||||
		mainLayout->addWidget(new QLabel(
 | 
			
		||||
		    "Please rebuild Quickshell against the current Qt version.\n"
 | 
			
		||||
		    "If this does not solve the problem, please open a bug report via github or email."
 | 
			
		||||
		));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	mainLayout->addWidget(new ReportLabel(
 | 
			
		||||
	    "Github:",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,7 @@
 | 
			
		|||
 | 
			
		||||
#include <qapplication.h>
 | 
			
		||||
#include <qconfig.h>
 | 
			
		||||
#include <qcoreapplication.h>
 | 
			
		||||
#include <qdatastream.h>
 | 
			
		||||
#include <qdir.h>
 | 
			
		||||
#include <qfile.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -12,7 +13,6 @@
 | 
			
		|||
#include <qtenvironmentvariables.h>
 | 
			
		||||
#include <qtextstream.h>
 | 
			
		||||
#include <qtversion.h>
 | 
			
		||||
#include <qversiontagging.h>
 | 
			
		||||
#include <sys/sendfile.h>
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue