Bug 399130

Summary: Krita 4.1.2/4.1.3 fail to build with Qt 5.6
Product: [Applications] krita Reporter: Wolfgang Bauer <wbauer1>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: halla
Priority: NOR    
Version First Reported In: 4.1.3   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Wolfgang Bauer 2018-09-27 08:07:59 UTC
Trying to build Krita 4.1.2 and 4.1.3 with Qt 5.6.2 failed with this compiler error:
/home/abuild/rpmbuild/BUILD/krita-4.1.2/libs/ui/tool/KisToolChangesTracker.cpp: In member function 'KisToolChangesTrackerDataSP KisToolChangesTracker::lastState() const':
/home/abuild/rpmbuild/BUILD/krita-4.1.2/libs/ui/tool/KisToolChangesTracker.cpp:55:38: error: operands to ?: have different types 'QSharedPointer<KisToolChangesTrackerData>' and 'int'
     return !m_d->undoStack.isEmpty() ? m_d->undoStack.last() : 0;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~

(that's with gcc7, 4.8 gave a more cryptic error "no match for ternary 'operator?:'")

I succeeded to build it with this change:
--- a/libs/ui/tool/KisToolChangesTracker.cpp
+++ b/libs/ui/tool/KisToolChangesTracker.cpp
@@ -52,7 +52,7 @@
 
 KisToolChangesTrackerDataSP KisToolChangesTracker::lastState() const
 {
-    return !m_d->undoStack.isEmpty() ? m_d->undoStack.last() : 0;
+    return !m_d->undoStack.isEmpty() ? m_d->undoStack.last() : static_cast<QSharedPointer<KisToolChangesTrackerData>>(0);
 }
 
 void KisToolChangesTracker::reset()
Comment 1 Halla Rempt 2018-09-27 08:09:15 UTC
Outch... I can push that, but I cannot postpone or recreate the release, and we're not going to release another 4.1.x, I'm afraid.
Comment 2 Halla Rempt 2018-09-27 08:18:04 UTC
Git commit 765cbfea64274f8fc405c78312f9cd1d117f3c90 by Boudewijn Rempt.
Committed on 27/09/2018 at 08:10.
Pushed by rempt into branch 'master'.

Fix building with Qt 5.6

M  +1    -1    libs/ui/tool/KisToolChangesTracker.cpp

https://commits.kde.org/krita/765cbfea64274f8fc405c78312f9cd1d117f3c90
Comment 3 Halla Rempt 2018-09-27 08:18:09 UTC
Git commit 90852da0a2ce60fe3ddaff819f2634ed55dbe943 by Boudewijn Rempt.
Committed on 27/09/2018 at 08:10.
Pushed by rempt into branch 'krita/4.1'.

Fix building with Qt 5.6

M  +1    -1    libs/ui/tool/KisToolChangesTracker.cpp

https://commits.kde.org/krita/90852da0a2ce60fe3ddaff819f2634ed55dbe943