From 8f81a22e7f26729cc2f4902ba7db8f696314539f Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 26 Jan 2018 10:40:04 +0100 Subject: Make report_error() reentrant Remove the global error buffer and pass the error string directly to the frontend. The frontend is then responsible for accumulating errors. Signed-off-by: Berthold Stoeger --- mobile-widgets/qmlmanager.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mobile-widgets') diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index e24bf8e01..18db13621 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -36,11 +36,12 @@ QMLManager *QMLManager::m_instance = NULL; #define NOCLOUD_LOCALSTORAGE format_string("%s/cloudstorage/localrepo[master]", system_default_directory()) -extern "C" void showErrorFromC() +extern "C" void showErrorFromC(char *buf) { + QString error(buf); + free(buf); // By using invokeMethod with Qt:AutoConnection, the error string is safely // transported across thread boundaries, if not called from the UI thread. - QString error(get_error_string()); QMetaObject::invokeMethod(QMLManager::instance(), "registerError", Qt::AutoConnection, Q_ARG(QString, error)); } -- cgit v1.2.3-70-g09d2