The problem is even after release() is done, the singleton variable is not cleared, so a new openCameraHardware() call could return an instance which is already released. The singleton variable is cleared in the destructor, so we wait until that happens in openCameraHardware().