RuntimeError: index out of bounds
-
Hello! I'm trying to write my first WebAssembly app, but I'm really struggling to make it work: I removed more and more objects from my Main.qml, always getting lots of errors (while for Desktop it compiles and runs without any issue). I finally removed EVERYTHING from the main, leaving it like this:
import QtQuick import QtQuick.Window import QtQuick.Layouts import QtQuick.Controls Window { width: 640 height: 480 visible: true title: qsTr("Hello World") TextField { text: "hello" } }
and again, in the browser console there's this error:
Uncaught RuntimeError: index out of bounds qtStdWebEventCallbackActivate http://localhost:30000/qtloader.js line 461 > eval line 5737 > Function:8 appNandoKaraoke.wasm:15590446:1 QCursor::shape() const http://localhost:30000/appNandoKaraoke.wasm:15590446 QWasmCursor::changeCursor(QCursor*, QWindow*) http://localhost:30000/appNandoKaraoke.wasm:12822937 QWindowPrivate::setCursor(QCursor const*) http://localhost:30000/appNandoKaraoke.wasm:15930234 QWindow::unsetCursor() http://localhost:30000/appNandoKaraoke.wasm:15930298 QQuickWindowPrivate::updateCursor(QPointF const&, QQuickItem*) http://localhost:30000/appNandoKaraoke.wasm:6317197 QQuickDeliveryAgentPrivate::handleMouseEvent(QMouseEvent*) http://localhost:30000/appNandoKaraoke.wasm:6859409 QQuickDeliveryAgent::event(QEvent*) http://localhost:30000/appNandoKaraoke.wasm:6856495 QQuickWindow::event(QEvent*) http://localhost:30000/appNandoKaraoke.wasm:6312986 QCoreApplicationPrivate::notify_helper(QObject*, QEvent*) http://localhost:30000/appNandoKaraoke.wasm:546717 QCoreApplication::notify(QObject*, QEvent*) http://localhost:30000/appNandoKaraoke.wasm:546880 QGuiApplication::notify(QObject*, QEvent*) http://localhost:30000/appNandoKaraoke.wasm:15694344 QCoreApplication::notifyInternal2(QObject*, QEvent*) http://localhost:30000/appNandoKaraoke.wasm:546136 QCoreApplication::sendSpontaneousEvent(QObject*, QEvent*) http://localhost:30000/appNandoKaraoke.wasm:548648 QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) http://localhost:30000/appNandoKaraoke.wasm:15700088 QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) http://localhost:30000/appNandoKaraoke.wasm:15695647 bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::MouseEvent, QWindow*, unsigned long, QPointF, QPointF, QFlags<Qt::MouseButton>, QFlags<Qt::KeyboardModifier>, Qt::MouseButton, QEvent::Type, Qt::MouseEventSource, bool, QPointingDevice const*>(QWindow*, unsigned long, QPointF, QPointF, QFlags<Qt::MouseButton>, QFlags<Qt::KeyboardModifier>, Qt::MouseButton, QEvent::Type, Qt::MouseEventSource, bool, QPointingDevice const*) http://localhost:30000/appNandoKaraoke.wasm:15953200 bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent<QWindowSystemInterfacePrivate::MouseEvent, QWindow*, unsigned long, QPointF, QPointF, QFlags<Qt::MouseButton>, QFlags<Qt::KeyboardModifier>, Qt::MouseButton, QEvent::Type, Qt::MouseEventSource, bool, QPointingDevice const*>(QWindow*, unsigned long, QPointF, QPointF, QFlags<Qt::MouseButton>, QFlags<Qt::KeyboardModifier>, Qt::MouseButton, QEvent::Type, Qt::MouseEventSource, bool, QPointingDevice const*) http://localhost:30000/appNandoKaraoke.wasm:15941411 bool QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::DefaultDelivery>(QWindow*, unsigned long, QPointF const&, QPointF const&, QFlags<Qt::MouseButton>, Qt::MouseButton, QEvent::Type, QFlags<Qt::KeyboardModifier>, Qt::MouseEventSource) http://localhost:30000/appNandoKaraoke.wasm:15960691 ClientArea::deliverEvent(PointerEvent const&) http://localhost:30000/appNandoKaraoke.wasm:12878766 ClientArea::processPointer(PointerEvent const&) http://localhost:30000/appNandoKaraoke.wasm:12878282 std::__2::__function::__func<ClientArea::ClientArea(QWasmWindow*, QWasmScreen*, emscripten::val)::$_0, std::__2::allocator<ClientArea::ClientArea(QWasmWindow*, QWasmScreen*, emscripten::val)::$_0>, void (emscripten::val)>::operator()(emscripten::val&&) http://localhost:30000/appNandoKaraoke.wasm:12884897 qstdweb::EventCallback::activate(emscripten::val) http://localhost:30000/appNandoKaraoke.wasm:2016590 emscripten::internal::Invoker<void, emscripten::val>::invoke(void (*)(emscripten::val), emscripten::_EM_VAL*) http://localhost:30000/appNandoKaraoke.wasm:2004472 qtStdWebEventCallbackActivate http://localhost:30000/qtloader.js line 461 > eval line 5737 > Function:8
after removing also the TextField the error is no longer present.
Why is this happening? how can I solve this?
with a more complex qml file I get a LOT of this errors, and sometimes the page breaks totally.
[WebAssembly Qt 6.5.2 (single-threaded)]
thanks in advance!
-
First make sure you are compiling with the correct Emscripten version for the Qt version you are using. For Qt 6.5.2 it should be Emscripten 3.1.25. If that doesn't work add this line to your cmake file: target_link_options(PocketSolver PUBLIC -s STACK_SIZE=5MB), this should fix your error.