diff --git a/client/listener.h b/client/listener.h index 624e7a2463..6bf5dccd80 100644 --- a/client/listener.h +++ b/client/listener.h @@ -140,7 +140,7 @@ template void listener<_type_>::listen() { // If you get an error here, your listener likely doesn't inherit from the // listener<> correctly. See the class documentation. - instances.insert(static_cast(this)); + instances.insert(dynamic_cast(this)); } /*************************************************************************** @@ -148,7 +148,7 @@ template void listener<_type_>::listen() ***************************************************************************/ template listener<_type_>::~listener() { - instances.erase(static_cast(this)); + instances.erase(dynamic_cast(this)); } /***************************************************************************