Showing the changes to libraries/script-engine/src/WebSocketClass.cpp (1 of 3 files). Show all
Unified · Split
| @@ -42,9 +42,7 @@ QScriptValue WebSocketClass::constructor(QScriptContext* context, QScriptEngine* · 41 unmodified lines | ||
| 42 | 42 | if (context->argumentCount() > 0) { |
| 43 | 43 | url = context->argument(0).toString(); |
| 44 | 44 | } |
| 45 | − auto webSocketClass = new WebSocketClass(engine, url); | |
| 46 | − connect(static_cast<ScriptEngine*>(engine), &ScriptEngine::finished, webSocketClass, &QObject::deleteLater); | |
| 47 | − return engine->newQObject(webSocketClass); | |
| 45 | + return engine->newQObject(new WebSocketClass(engine, url), QScriptEngine::ScriptOwnership); | |
| 48 | 46 | } |
| 49 | 47 | |
| 50 | 48 | WebSocketClass::~WebSocketClass() { |
| @@ -111,7 +109,7 @@ void qWSCloseCodeFromScriptValue(const QScriptValue &object, QWebSocketProtocol: · 60 unmodified lines | ||
| 111 | 109 | } |
| 112 | 110 | |
| 113 | 111 | QScriptValue webSocketToScriptValue(QScriptEngine* engine, WebSocketClass* const &in) { |
| 114 | − return engine->newQObject(in); | |
| 112 | + return engine->newQObject(in, QScriptEngine::ScriptOwnership); | |
| 115 | 113 | } |
| 116 | 114 | |
| 117 | 115 | void webSocketFromScriptValue(const QScriptValue &object, WebSocketClass* &out) { |