It's better to invoke
```c++
listener->setRegistered(false);
```
before
```c++
listener->release();
```