Fix a mess in contexts/surfaces reference count

The main issue was that SmartPtr had an implicit cast to void*, returning its
internal pointer. This allowed writing unsafe code, since the internal pointer
could be handled without increasing its ref count.
So, removed this cast and fixed the various places which relied on it.
Also, fix two calls to "destroy" ahich should have been "markForDestruction".
The naming is not good, should probably change it in a later patch.

Change-Id: Idabc800e97649b2e2404fb7387d25deac70af62e
5 files changed