Project

General

Profile

Actions

Feature #2202

open

Parent WObject parameter in WTimer single shot function

Added by Saif Rehman over 10 years ago. Updated over 10 years ago.

Status:
Feedback
Priority:
Normal
Assignee:
Target version:
-
Start date:
09/11/2013
Due date:
% Done:

0%

Estimated time:

Description

Hi,

There should be a parameter that should take parent WObject parameter when creating a new WTimer to take the advantage of WObject's memory management and to avoid calling the callback function on a deleted object or avoid accessing deleted objects.

Actions #1

Updated by Wim Dumon over 10 years ago

Saif,

If the receiver parameter inherits from Object, the timer should be disconnected when it fires...

BR,

Wim.

Actions #2

Updated by Saif Rehman over 10 years ago

Oh. But I was using lambda so I thought that there should be a parent parameter

Actions #3

Updated by Wim Dumon over 10 years ago

We cannot do that with lambda currently. We have to come up with a system to improve tracking with lambdas.

BR,

Wim.

Actions #4

Updated by Saif Rehman over 10 years ago

maybe use the parent parameter in case of lambdas?

Actions #5

Updated by Wim Dumon over 10 years ago

  • Status changed from New to Feedback

In WObject there's an undocumented class DeletionTracker (in the usage example it's demonstrated to track this, but I believe it can track any WObject).

I'm thinking of something in that direction, but then generalized for use with every functor based connect, ideally in such a way that you can specify multiple tracked objects per connection. You want to be able to express this for any signal, not just for WTimer.

BR,

Wim.

Actions #6

Updated by Saif Rehman over 10 years ago

Can't think of a simple solution however maybe WObject could have a method "trackObject(WObject)" which would add objects to be tracked for deletion.

Actions #7

Updated by Koen Deforche over 10 years ago

  • Assignee set to Wim Dumon
Actions

Also available in: Atom PDF