Quantcast
Viewing all articles
Browse latest Browse all 4972

How to do delete later in QML JavaScript?

I have a VideoThumbnail class inherits from QQuickItem, used in QML. VideoThumbnail has a callback thread which may post update event while the VideoThumbnail object is being destroyed, this race condition could incur crash. From what I read, deleteLater is needed, since JavaScript cannot call deleteLater directly, I create a Q_INVOKABLE method say DeleteMeLater in VideoThumbnail class and call deleteLater in the method. In QML JavaScript, it looks like VideoThumbnail { id: videoThumbnail … Component.onDestruction:{ videoThumbnail.DeleteMeLater() } } Has anyone here done this before and could provide suggestions? Also is Component.onDestruction DirectConnection? and I assume destruction is emitted before any destruction starts? Delayed destroy is not the solution I am looking for. Thanks

Viewing all articles
Browse latest Browse all 4972

Trending Articles