Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QtWinmigrate and __fastfail on deleting Qt Quick models
Forum Updated to NodeBB v4.3 + New Features

QtWinmigrate and __fastfail on deleting Qt Quick models

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 222 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    antdm
    wrote on last edited by antdm
    #1

    Hi,

    I'm using qtwinmigrate with Qt 5.12.5 to display Qt Quick controls in a Win32 app.

    More specifically, I have a C interface to a dll where I host a QQmlEngine instance that renders things through QQuickWidget which I show in the client application with help of QWinWidget (which is part of the qtwinmigrate framework).

    If I don't delete model objects then there is memory leaking each time when I hide then show the widget even if I don't recreate model objects but reusing old objects from a pool instead. I suspect old QML objects to be leaking.

    Since deleteLater() doesn't work because of absence of main Qt thread executing QApplication's event loop I've googled next way to delete model objects:

    QApplication::postEvent(m_Model, new QDeferredDeleteEvent());
    Application::sendPostedEvents(0, QEvent::DeferredDelete);
    

    It seemed to work well, everything was working fine and no memory was leaking. Unfortunately, I've recently discovered that sometimes it results in calls to __fastfail with next message:

    Object destroyed while one of its QML signal handlers is in progress. Most likely the object was deleted synchronously (use QObject::deleteLater() instead), or the application is running a nested event loop. This behavior is NOT supported!

    Calling disconnect() on these objects prior to deleting doesn't help.

    An attempt to create a QThread in the dll, move QApplication instance to this thread and run its event loop through calling exec() on it, then call deleteLater() on model objects normally failed as well. Model objects were not being deleted in this case. I might have done something wrong though.

    Do you have any suggestions what can I do with this problem?

    Thanks!

    UPD:
    I've tried to reimplement the "in-dll QThread" approach once again since I definitely did it wrong for the first time. Now everything is created and lives in that thread but I can't display the control:

    1. I see next warning from Qt:

    WARNING: QApplication was not created in the main() thread.

    1. QWinWidget's constructor hangs on next call
    SetWindowLong((HWND)winId(), GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
    

    And since I'm using Qt::BlockingQueuedConnection for synchronization with the main thread it hangs as well.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved