Showing the changes to interface/src/ui/JSConsole.cpp (1 of 49 files). Show all
Unified · Split
| @@ -308,7 +308,7 @@ void JSConsole::highlightedCompletion(const QModelIndex& completion) { · 307 unmodified lines | ||
| 308 | 308 | |
| 309 | 309 | JSConsole::~JSConsole() { |
| 310 | 310 | if (_scriptManager) { |
| 311 | − disconnect(_scriptManager.data(), nullptr, this, nullptr); | |
| 311 | + disconnect(_scriptManager.get(), nullptr, this, nullptr); | |
| 312 | 312 | _scriptManager.reset(); |
| 313 | 313 | } |
| 314 | 314 | delete _ui; |
| @@ -319,21 +319,21 @@ void JSConsole::setScriptManager(const ScriptManagerPointer& scriptManager) { · 4 unmodified lines | ||
| 319 | 319 | return; |
| 320 | 320 | } |
| 321 | 321 | if (scriptManager != nullptr) { |
| 322 | − disconnect(_scriptManager.data(), nullptr, this, nullptr); | |
| 322 | + disconnect(_scriptManager.get(), nullptr, this, nullptr); | |
| 323 | 323 | _scriptManager.reset(); |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | // if scriptEngine is nullptr then create one and keep track of it using _ownScriptEngine |
| 327 | − if (scriptManager.isNull()) { | |
| 327 | + if (!scriptManager) { | |
| 328 | 328 | _scriptManager = DependencyManager::get<ScriptEngines>()->loadScript(_consoleFileName, false); |
| 329 | 329 | } else { |
| 330 | 330 | _scriptManager = scriptManager; |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | − connect(_scriptManager.data(), &ScriptManager::printedMessage, this, &JSConsole::handlePrint); | |
| 334 | − connect(_scriptManager.data(), &ScriptManager::infoMessage, this, &JSConsole::handleInfo); | |
| 335 | − connect(_scriptManager.data(), &ScriptManager::warningMessage, this, &JSConsole::handleWarning); | |
| 336 | − connect(_scriptManager.data(), &ScriptManager::errorMessage, this, &JSConsole::handleError); | |
| 333 | + connect(_scriptManager.get(), &ScriptManager::printedMessage, this, &JSConsole::handlePrint); | |
| 334 | + connect(_scriptManager.get(), &ScriptManager::infoMessage, this, &JSConsole::handleInfo); | |
| 335 | + connect(_scriptManager.get(), &ScriptManager::warningMessage, this, &JSConsole::handleWarning); | |
| 336 | + connect(_scriptManager.get(), &ScriptManager::errorMessage, this, &JSConsole::handleError); | |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | void JSConsole::executeCommand(const QString& command) { |
| @@ -349,13 +349,13 @@ void JSConsole::executeCommand(const QString& command) { · 9 unmodified lines | ||
| 349 | 349 | |
| 350 | 350 | appendMessage(">", "<span style='" + COMMAND_STYLE + "'>" + command.toHtmlEscaped() + "</span>"); |
| 351 | 351 | |
| 352 | − QWeakPointer<ScriptManager> weakScriptManager = _scriptManager; | |
| 352 | + std::weak_ptr<ScriptManager> weakScriptManager = _scriptManager; | |
| 353 | 353 | auto consoleFileName = _consoleFileName; |
| 354 | 354 | QFuture<ScriptValue> future = QtConcurrent::run([weakScriptManager, consoleFileName, command]() -> ScriptValue { |
| 355 | 355 | ScriptValue result; |
| 356 | 356 | auto scriptManager = weakScriptManager.lock(); |
| 357 | 357 | if (scriptManager) { |
| 358 | − BLOCKING_INVOKE_METHOD(scriptManager.data(), "evaluate", | |
| 358 | + BLOCKING_INVOKE_METHOD(scriptManager.get(), "evaluate", | |
| 359 | 359 | Q_RETURN_ARG(ScriptValue, result), |
| 360 | 360 | Q_ARG(const QString&, command), |
| 361 | 361 | Q_ARG(const QString&, consoleFileName)); |