[sigc] Unexpected behavior when freeing a trackable object from inside a slot



Hi,

I noticed that if a trackable object is freed from inside the slot which is setup to track this object then the slot is immediately invalidated. Problem arises when such a slot holds a lambda which captures some other variables by-value or some variables are bound by value to the slot. In such cases the invalidation of the slot causes all bound object instances to be immediately freed.

I have attached a test case patch (for the current master) which demonstrates the issue using lambda captures and sigc::bind bounds.

    My question: is it a bug or it's supposed to work like that?

The patch also contains a 3rd test which disconnects the slot explicitly from inside the lambda slot with captured variables, but in this case it doesn't cause captured variables to be freed right from inside the slot. So I'm inclined to think that track_obj should behave in a similar safe way.

BR, Andrey

Attachment: free_trackable_from_slot.patch
Description: Text Data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]