Bug 429815

Summary: #8831937ffe4 broke compatiblity with older Qt5 versions
Product: [Applications] kdevelop Reporter: RJVB <rjvbertin>
Component: CPP DebuggerAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: niko.sams
Priority: NOR    
Version First Reported In: git master   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description RJVB 2020-11-29 16:55:03 UTC
The commit mentioned in the title assumes that a QStringRef instance can be cast to a const Qstring automatically. I don't know what Qt version introduced that compatibility but it's not in Qt 5.9 .

Adding an explicit .toString() fixes the build failure.
Comment 1 Milian Wolff 2020-11-30 10:14:55 UTC
please fix it then
Comment 2 RJVB 2020-11-30 10:58:29 UTC
I don't think we have to be concerned with the potential additional overhead of creating a copy of the string as `toString()` appears to do? I don't see anything about a new cast operator in the Qt 5.15 documentation for QStringRef nor any new overloads of QVersionNumber::fromString() that would be used here so it's a bit of a mystery to me why the code builds as is.
Comment 3 RJVB 2020-11-30 13:22:46 UTC
> it's a bit of a mystery to me why the code builds as is.

Got that: newer versions of QVersionNumber::fromString() can take a QStringView, which has a ctor taking a QStringRef.
Comment 4 Milian Wolff 2020-11-30 16:30:07 UTC
so, can you then please fix it? you didn't even paste an error message that would show which file fails to build with that old Qt version
Comment 5 RJVB 2020-11-30 18:57:47 UTC
Apologies, my bad. The failure is in DebugSession::handleVersion() in plugins/gdb/debugsession.cpp (line 288 to be precise).
Comment 6 RJVB 2020-11-30 19:00:38 UTC
Git commit 87979acc1a6c9f401d3c19ab516fa38b1d053233 by René Bertin.
Committed on 30/11/2020 at 18:54.
Pushed by rjvbb into branch '5.6'.

Restore compatibility with Qt < 5.10

M  +1    -1    plugins/gdb/debugsession.cpp

https://invent.kde.org/kdevelop/kdevelop/commit/87979acc1a6c9f401d3c19ab516fa38b1d053233