Obtaining a pointer to self for use with a C function

After having searched for the "correct" way of doing this, I came across this post : How do I get a pointer to self.

Great, I thought, so I put in place the solution which was stated to work :

func ptrToSelf() -> UnsafeMutableRawPointer {
        var mySelf = self
        return UnsafeMutableRawPointer(&mySelf)
    }

And it works ! Super !

However, I am getting this warning :

Initialization of 'UnsafeMutableRawPointer' results in a dangling pointer

I looked again at the post and saw that Quinn had referenced another one ... but it is no longer available.

So, my obvious question here - for it is worrying me - is this a real problem ?

Is there another way of getting a pointer to self which is more 'secure' ?

Obtaining a pointer to self for use with a C function
 
 
Q