[Interest] [Qt3D] Logic aspect hangs on exit

Nye kshegunov at gmail.com
Thu Dec 17 11:39:57 CET 2015


Hello Sean,
I'm not entirely convinced that it is really a problem with Qt3D, it still
very well be my code. Here is how my data structure looks like:

struct AgMapData  {
    QAspectEngine aspectEngine;
    QOpenGLWindow window;
    QWidget * container;
    QFrameGraph * frameGraph;
    QEntity * rootEntity;
    QCamera * camera;
} data;

If I change the QOpenGLWindow to be created in the heap there is no
deadlock, but instead I get a segmentation fault in
Qt3DRenderer::Render::Renderer::doRender @ Renderer.cpp/555 as well as
the following message in the output window:

QThread: Destroyed while thread is still running
ASSERT: "allocator->isEmpty()" in file backend/renderer.cpp, line 555

>From what I can tell the window is destroyed in the GUI thread by Qt,
while the render thread is trying to actually perform rendering. My
suspicion is that when the window is created in the stack this is
moot, since the window will not be deallocated until the the
QAspectEngine's destructor has finished, which is where I get the
deadlock. I could provide a backtrace as well, if you wish and will
make your investigations easier.

Kind regards.


On Thu, Dec 17, 2015 at 12:20 PM, Sean Harmer <sean.harmer at kdab.com> wrote:

> On Thursday 17 Dec 2015 12:17:48 Nye wrote:
> > Hello Harald,
> > In fact this is what I'm attempting, but realized that there is a more
> > "subtle" way to do it. I think that switching the root entity and/or the
> > frame graph would be more appropriate, than to actually create two
> separate
> > GL widgets/windows.
> >
> > Sean,
> > No I don't really have any specific use cases. I think how it's now is
> > fine. I believe my code hangs because of the order of destruction of my
> > widgets, coupled with me creating the aspect engine on the stack. The
> > actual dead-lock I get in qaspectmanager.cpp @ 246 :
> m_waitForEndOfExecLoop.
> > acquire(1);
> > My guess is for some reason, because of the structure of my objects, the
> > event loop is not exiting. Still I wasn't able to reproduce it in a clean
> > separate projects, so I'll continue debugging and if necessary will file
> a
> > bug report.
>
> Hmm, I wonder if this regression is a side effect of another fairly recent
> fix
> made to avoid a data race with dynamically updated buffers and VAOs in the
> renderer. I'll dig into it. Thanks for the info.
>
> Sean
>
> >
> > Kind regards.
> >
> > On Thu, Dec 17, 2015 at 12:08 PM, Harald Vistnes <
> harald.vistnes at gmail.com>
> >
> > wrote:
> > > Hi,
> > >
> > > I'm also interested in how to handle multiple windows with Qt3D. My use
> > > case is a widgets based CAD like application that will have two
> > > independent
> > > 3D windows in a QStackedWidget (so only one 3D window will be visible
> at a
> > > time). They will have different models loaded and the user will switch
> > > from
> > > one window to the other. Also, for each window, it must be possible to
> > > render the current view (root QEntity) to a high-res image.So in this
> case
> > > I guess there will be one QAspectEngine for each of the windows and
> then
> > > temporary QAspectEngines for offscreen rendering that shares the root
> > > entity with the other QAspectEngines?
> > >
> > > Harald
> > >
> > > 2015-12-17 10:49 GMT+01:00 Sean Harmer <sean.harmer at kdab.com>:
> > >> On Thursday 17 Dec 2015 11:37:49 Nye wrote:
> > >> > Hello,
> > >> > It (most probably) is a problem with my code. I've created two
> aspect
> > >> > engines (this is in a widget and I have two instances). I suppose
> > >> > having
> > >> > two aspect engines is not allowed? I've done it this way, because
> the
> > >> > aspect engine handles a single surface/window. Interestingly, it
> > >> > happens
> > >> > only with the logic aspect. On a related note, what would be the
> proper
> > >>
> > >> way
> > >>
> > >> > to use two gl windows with Qt3D?
> > >>
> > >> At present it is indeed to make two QAspectEngines as you are doing.
> This
> > >> is
> > >> something I'm looking into at the moment as it happens - well more
> > >> generally
> > >> what top level integration points do we need to support for the
> initial
> > >> version.
> > >>
> > >> If you have specific use cases, I'd be interested to hear what they
> are.
> > >>
> > >> Cheers,
> > >>
> > >> Sean
> > >>
> > >> > Kind regards.
> > >> >
> > >> > On Thu, Dec 17, 2015 at 10:52 AM, Sean Harmer <sean.harmer at kdab.com
> >
> > >>
> > >> wrote:
> > >> > > Hi,
> > >> > >
> > >> > > Can you file a bugreport with a small test case for this please?
> This
> > >>
> > >> was
> > >>
> > >> > > certainly working in the cases I tested. Perhaps there's a
> regression
> > >>
> > >> we
> > >>
> > >> > > need
> > >> > > to fix.
> > >> > >
> > >> > > Thanks,
> > >> > >
> > >> > > Sean
> > >> > >
> > >> > > On Thursday 17 Dec 2015 09:51:51 Nye wrote:
> > >> > > > Hello,
> > >> > > > It seems for some reason that adding a logic aspect to the
> aspect
> > >>
> > >> engine
> > >>
> > >> > > > causes the application to "hang" on exit. My guess is that for
> some
> > >> > >
> > >> > > reason
> > >> > >
> > >> > > > the shutdown sequence is not executing properly and the threads
> in
> > >>
> > >> the
> > >>
> > >> > > pool
> > >> > >
> > >> > > > are left in waiting. Is there currently a workaround for that
> (i.e.
> > >>
> > >> can
> > >>
> > >> > > > I
> > >> > > > manually shutdown the aspect engine)? I'm creating the aspect
> > >>
> > >> engine on
> > >>
> > >> > > the
> > >> > >
> > >> > > > stack, maybe this is an issue?
> > >> > > > I'm developing on Debian stretch with 4.2 kernel, if that helps.
> > >>
> > >> Qt3D is
> > >>
> > >> > > > compiled from the most recent source available in the git
> > >>
> > >> repository for
> > >>
> > >> > > > the 5.6 branch.
> > >> > > >
> > >> > > > Kind regards.
> > >> > >
> > >> > > --
> > >> > > Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
> > >> > > KDAB (UK) Ltd, a KDAB Group company
> > >> > > Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
> > >> > > Mobile: +44 (0)7545 140604
> > >> > > KDAB - Qt Experts
> > >>
> > >> --
> > >> Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
> > >> KDAB (UK) Ltd, a KDAB Group company
> > >> Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
> > >> Mobile: +44 (0)7545 140604
> > >> KDAB - Qt Experts
> > >> _______________________________________________
> > >> Interest mailing list
> > >> Interest at qt-project.org
> > >> http://lists.qt-project.org/mailman/listinfo/interest
>
> --
> Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
> KDAB (UK) Ltd, a KDAB Group company
> Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
> Mobile: +44 (0)7545 140604
> KDAB - Qt Experts
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151217/d2a4a7c1/attachment.html>


More information about the Interest mailing list