Generator class holds a reference to an analyser model#1439
Conversation
hsorby
commented
Jun 15, 2026
- Addresses Make Generator class stateless #1395
agarny
left a comment
There was a problem hiding this comment.
The original issue (#1395) talks about the Generator class "either hold[ing] a weak pointer to the AnalyserModel or drop[ping] its reference when it has finished with it`. I feel like holding a weak pointer would be better. So, what was the rationale for taking the other option?
|
Just holding a weak pointer would mean checking it constantly everytime you wanted to use it as it could be deleted at any time. By holding a shared pointer you are certain to be holding the object until you are finished with it, which we do by resetting the pointer when we are finished using it for generating code. |
Indeed, fair enough! |