Quote Originally Posted by newtoQ_s View Post
Thanks, but I am unable to understand as to how I can correct this error.
You allocate the model on the heap instead.

A stack allocated object's live time ends at the end of the block scope it was created in.

Cheers,
_