File kinfocenter-fix-cmdline-parsing.patch of Package kinfocenter5.openSUSE_Leap_42.1_Update

From: Antonio Larrosa <larrosa@kde.org>
Date: Fri, 23 Oct 2015 12:57:44 +0000
Subject: Fix kinfocenter crash when run with --version
X-Git-Url: http://quickgit.kde.org/?p=kinfocenter.git&a=commitdiff&h=fe16e35904587266f37114ac682916e449677054
---
Fix kinfocenter crash when run with --version

Fix the order in which kinfocenter is initialized to first do all
commandline parsing and only then create windows. In other case
running "kinfocenter --version" crashes when unloading dynamic libraries
that shouldn't have been loaded at all.
---


--- a/main.cpp
+++ b/main.cpp
@@ -37,14 +37,7 @@
 {
     QApplication::setApplicationDisplayName(i18n("KDE Info Center"));
     QApplication::setOrganizationDomain("kde.org");
-    display = new KInfoCenter();
-    display->show();
 
-    KDBusService* service = new KDBusService(KDBusService::Unique, this);
-}
-
-int main(int argc, char *argv[])
-{
     KLocalizedString::setApplicationDomain("kinfocenter");
 
     KAboutData aboutData( QStringLiteral("kinfocenter"), i18n("KDE Info Center"),
@@ -60,14 +53,23 @@
     aboutData.addAuthor(i18n("Waldo Bastian"), QString(), QStringLiteral("bastian@kde.org"));
     aboutData.addAuthor(i18n("Nicolas Ternisien"), QString(), QStringLiteral("nicolas.ternisien@gmail.com"));
     KAboutData::setApplicationData(aboutData);
-    KicApp Kic(argc, argv);
 
     QCommandLineParser parser;
     parser.addHelpOption();
     parser.addVersionOption();
     aboutData.setupCommandLine(&parser);
-    parser.process(Kic);
+    parser.process(*this);
     aboutData.processCommandLine(&parser);
+
+    display = new KInfoCenter();
+    display->show();
+
+    KDBusService* service = new KDBusService(KDBusService::Unique, this);
+}
+
+int main(int argc, char *argv[])
+{
+    KicApp Kic(argc, argv);
 
     return Kic.exec();
 }

openSUSE Build Service is sponsored by