cyclus/core — Issue #33: kill messages that came from now-deallocated models
Author: rwcarlsen
Created: 2012-02-13 20:27:11+00:00
State: open
Labels: Bug

Proposed solution

* Have a private method in the model class named trackMessage(msg_ptr). This method will add the passed msg_ptr to a member var list of messages that have passed through that model (on their way up).

* have another model class private method named untrackMessage(msg_ptr) which will remove a message from the same list (messages are untracked if they pass back through on their way 'down' the model hierarchy)

* the message class must be a friend of the model class.

* the Message class's sendOn method will appropriately call the trackMessage and untrackMessage methods of the models that it is being sent to/from.

* the message class will have a kill() method that will effectively render the message's sendOn method do nothing. - the message will effectively be unable to be passed anywhere - shortly after which, it should be automatically deallocated with no remaining refs to it.

* the model class destructor will kill() all messages that are in its tracked_messages_ member var. This will render all those messages unable to return to the now deallocated model.