Lifetime of BaseRefCounted class fields
Posted: 23 Sep 2026, 16:34
Hi! Official examples expose raw pointers to instances of BaseRefCounted fields of view models to the view. It does not look right, because any control can create Noesis::Ptr from such raw pointer which will call delete this; and thus will lead to subtle bugs and crashes. In our project we're indeed experience such random (and somewhat rare) crashes which affects our overall crash-rate which negatively impacts our project in app stores.
For example, the most common place of crashes are commands. If a command instance is stored directly as a field (not allocated on heap), exposed to reflection as a raw pointer via getter it will cause crash in some cases. The obvious fix for this issue is indeed to use Noesis::Ptr + Noesis::MakePtr . So what's your opinion on this issue?
For example, the most common place of crashes are commands. If a command instance is stored directly as a field (not allocated on heap), exposed to reflection as a raw pointer via getter it will cause crash in some cases. The obvious fix for this issue is indeed to use Noesis::Ptr + Noesis::MakePtr . So what's your opinion on this issue?