Allow providing an error message from the application
ClosedPublic

Authored by apol on Mar 11 2020, 3:51 PM.

Details

Summary

Allows us keep the message provided by QQuickWindow::sceneGraphError to later have on our bug reports.
https://doc.qt.io/qt-5/qquickwindow.html#sceneGraphError
These are generally problems at the OpenGL level that the user will usually be unable to take action on.

CCBUG: 375913

Test Plan

See D27985

Diff Detail

Repository
R285 KCrash
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
apol created this revision.Mar 11 2020, 3:51 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptMar 11 2020, 3:51 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
apol requested review of this revision.Mar 11 2020, 3:51 PM

Unit test? (:

I also wonder if maybe this should be lazy allocated. The vast majority of applications probably will never set it, so allocating the memory on first use should be better for the great majority of applications while making no difference for the gdb side of crash reporting.

src/kcrash.cpp
992

& on the wrong side of the space

apol updated this revision to Diff 77451.Mar 11 2020, 6:59 PM
apol marked an inline comment as done.

We were already creating a QByteArray, just keep it instead of allocating constantly

sitter added a subscriber: dfaure.

Paging @dfaure for expert input.
Is that global static qbytearray safe? Should we make it a q_global_static to comply with our library policy? Any objections to the diff?

dfaure requested changes to this revision.Mar 12 2020, 8:50 PM

Every other static variable here is a char* so that there's no global constructor being called at application startup.
Why not do the same? Just strdup the result of the toUtf8() call.

BTW: why the 1024 limit?

This revision now requires changes to proceed.Mar 12 2020, 8:50 PM
apol updated this revision to Diff 77522.Mar 12 2020, 10:10 PM

Prefer char*

sitter added inline comments.Mar 13 2020, 10:34 AM
src/kcrash.cpp
107
  • on wrong side of space

needs defining to nullptr

994

I fear that is now leaking when the function is called more than once

if (s_kcrashErrorMessage) {
free(s_kcrashErrorMessage);
}
apol updated this revision to Diff 77551.Mar 13 2020, 12:16 PM

cleanup

sitter added inline comments.Mar 13 2020, 12:18 PM
src/kcrash.cpp
107

Still needs to be set to nullptr.

apol updated this revision to Diff 77552.Mar 13 2020, 12:34 PM

nullptr

Looks alright to me now. 👍

dfaure accepted this revision.Mar 15 2020, 9:23 AM
This revision is now accepted and ready to land.Mar 15 2020, 9:23 AM
This revision was automatically updated to reflect the committed changes.

The following is notice that I intend to revert this change, along with the corresponding commits that make use of this functionality in Dr Konqi, as they cause a FTBFS on both FreeBSD and Windows which has not been addressed.
This regression is over a week old at this point.

Please see https://build.kde.org/view/Failing/job/Plasma/job/drkonqi/job/kf5-qt5%20FreeBSDQt5.13/lastFailedBuild/ and https://build.kde.org/view/Failing/job/Plasma/job/drkonqi/job/kf5-qt5%20WindowsMSVCQt5.14/lastFailedBuild/ for more information.

ahmadsamir added a subscriber: ahmadsamir.EditedMar 17 2020, 10:12 AM

The following is notice that I intend to revert this change, along with the corresponding commits that make use of this functionality in Dr Konqi, as they cause a FTBFS on both FreeBSD and Windows which has not been addressed.
This regression is over a week old at this point.

Please see https://build.kde.org/view/Failing/job/Plasma/job/drkonqi/job/kf5-qt5%20FreeBSDQt5.13/lastFailedBuild/ and https://build.kde.org/view/Failing/job/Plasma/job/drkonqi/job/kf5-qt5%20WindowsMSVCQt5.14/lastFailedBuild/ for more information.

The FreeBSD issue at least should be fixed by D28095.

EDIT: the windows one is probably the same issue, though I couldn't discern the actual error from the build log.