Unexpected/Uncalled Deferred Delete Event of QObject

  • Hello everyone,

    we are having trouble with a deferred delete event which gets called on one of our QObjects and we can't get the source/reasoning for this event to be called. The problem seems to be related to rendering OpenGL content.

    Our software is using QtQuick (5.4) for the GUI and C++ for business logic. As we need to display 3D models and interact with them we use OpenGL to draw these models inside our GUI. Our implementation is derived from this example, so we are rendering our OpenGL content to a texture which is then displayed via a QtQuickItem.

    The problem is that sometimes the current instance of our rendering class (which does solely the rendering of the OpenGL content) gets destroyed by an deferred delete event. We currently have no clue where this event is originated, as we have neither a single deleteLater() call in our program nor do we use any destructive calls on that object ourselves. This delete event seems to be triggered somewhere in the Qt framework and seems to be related to the OpenGL rendering as it gets mainly called when switching views or when the GUI has to do heavy rendering (i.e. redrawing a calender control consisting of lots of rectangles multiple times a second when a user tries to switch months extremely fast).

    Callstack (the class SceneRendererScanSection gets "accidently" destroyed - the destructors of its base classes get of coarse also called)

    The questions I have in this regard are:

    • Are there any known issues with the way of integrating custom OpenGL context in a QtQuick GUI the way linked above in the example which would explain such a behaviour?

    • Is there a way to find out exactly what and why this deferred delete event has been triggered (and how to prevent it)?

    Thanks in advance for any input trying to narrow down the problem.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What did you do differently from the example ?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.