Project

General

Profile

Feature #2202

Parent WObject parameter in WTimer single shot function

Added by Saif Rehman almost 9 years ago. Updated almost 9 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.

#1

Updated by Wim Dumon almost 9 years ago

Saif,

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

BR,

Wim.

#2

Updated by Saif Rehman almost 9 years ago

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

#3

Updated by Wim Dumon almost 9 years ago

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

BR,

Wim.

#4

Updated by Saif Rehman almost 9 years ago

maybe use the parent parameter in case of lambdas?

#5

Updated by Wim Dumon almost 9 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.

#6

Updated by Saif Rehman almost 9 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.

#7

Updated by Koen Deforche almost 9 years ago

  • Assignee set to Wim Dumon

Also available in: Atom PDF