Page 1 of 1

NOTE TO SELF: /bangs head over and over

Posted: Mon Sep 12, 2011 12:46 am
by short
/rant

I'm really trying to make this stick in my head, as I seem to have done it three or four times, and spent way too long trying to debug it each time.. This post will serve as a conscious reminder to myself, if I run into the issue again I can at-least look at my post history here and remind myself..

DO NOT pass a stack-allocated object to a smart pointer.

I'm not sure why I can't seem to remember this. I keep allocating memory on the stack (usually a great thing). But then failing all over the place and passing its memory address to a smart pointer.... this leads to a nice double delete "feature."

/endrant

Anyone else found this out the long/difficult way? Or am I the only one............