[Development] [QML] Singletons are deleted before the other objects

Chris Adams chris.adams at qinetic.com.au
Mon Sep 22 05:45:36 CEST 2014


Hi,

On Fri, Sep 19, 2014 at 10:37 PM, BogDan <bog_dan_ro at yahoo.com> wrote:

> Hello folks,
>
>   Singletons registered using qmlRegisterSingletonType, are deleted
> *before*
> the other active objects. I consider it to be wrong because some of the
> active
> objects may still need to access the singletons in their destructor ...
>
> IMHO singletons should be the very last objects deleted (also in the
> reverse
> order).
>

I tend to agree that they should be deleted last.  Enforcing deletion in
the reverse
order to how they were registered might impose some slight performance
penalty
at instantiation time, however, depending on how the deletion order is
determined
at cleanup time, since they are instantiated on demand (and hence possibly
out-of-order).


>
> Is there any reason why they are deleted before the other active objects?
> Or this is just a bug?
>

I don't believe that there is any particular reason for deleting them prior
to other
active objects, but perhaps Simon or Lars can correct me on this point.
Nonetheless, I don't think that the current behaviour is a bug, per-se, as
the
destruction order was never documented or guaranteed, as far as I know.

Cheers,
Chris.


>
> Cheers,
> BogDan.
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140922/e90a16ca/attachment.html>


More information about the Development mailing list