https://bugs.kde.org/show_bug.cgi?id=427052
Bug ID: 427052 Summary: The "wait" command cause cpu overheat Product: kturtle Version: unspecified Platform: unspecified OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: general Assignee: c...@kde.nl Reporter: hugues.larr...@laas.fr Target Milestone: --- SUMMARY The "wait" command cause cpu overheat ! STEPS TO REPRODUCE Running the following code : reset wait 10 OBSERVED RESULT On an i7-8665U, CPU run at full speed (4.20GHz turbo boost) for 10 seconds EXPECTED RESULT CPU stay cool (~700MHz) SOFTWARE/OS VERSIONS kturtle 19.12.3 / Ubuntu 20.04 / Mate desktop kturtle 18.04.1 / Debian buster / Mate desktop kturtle 18.04.1 (backported) / Debian stretch amd64 / Mate desktop kturtle 18.04.1 (backported) / Debian stretch i386 / Mate desktop kturtle 16.08.3 / Debian stretch i386 / Mate desktop ADDITIONAL INFORMATION I have solved the problem for myself using the following workaround: +++ kturtle-19.12.3/src/interpreter/executer.cpp @@ -26,14 +26,13 @@ #include <errno.h> #include <math.h> -#include <QTimer> // for wait +#include <unistd.h> // for usleep #include <QDebug> #include <krandom.h> #include <KLocalizedString> #include <QtMath> void Executer::initialize(TreeNode* tree, ErrorList* _errorList) { rootNode = tree; @@ -631,7 +630,9 @@ void Executer::executeWait(TreeNode* nod if (!checkParameterQuantity(node, 1, 20000+Token::Wait*100+90)) return; if (!checkParameterType(node, Value::Number, 20000+Token::Wait*100+91) ) return; waiting = true; - QTimer::singleShot(static_cast<int>(1000*node->child(0)->value()->number()), this, &Executer::stopWaiting); + usleep(static_cast<int>(1000000*node->child(0)->value()->number())); + waiting = false; + return; } void Executer::executeAssert(TreeNode* node) { // //qDebug() << "called"; so I don't know if it is a bug from kturtle or from QT, I don't really understanding c++... Happy Hacking. -- You are receiving this mail because: You are watching all bug changes.