coverity#1241199 Unchecked dynamic_cast

Change-Id: I53ace3f34036f2c78201aea7fb4a4a2e7c750654
coverity#1210000 Uncaught exception

and

coverity#1210001 Uncaught exception

Change-Id: Ia6ef659ba6e62d56813a87c3fcf0fa4a5d26d9f9
ensure that osl_atomic_decrement gets called after osl_atomic_increment

Change-Id: If110d27950a4efd1a96dc5f2702f4dfbfe58bcbe