Skip to content

Commit

Permalink
Fix weak vtables / dynamic_cast errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardnormier committed Nov 26, 2024
1 parent b5b44a0 commit fcb4343
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cpp/include/Ice/Endpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ namespace Ice
class ICE_API TCPEndpointInfo final : public IPEndpointInfo
{
public:
~TCPEndpointInfo() final;
TCPEndpointInfo(const TCPEndpointInfo&) = delete;
TCPEndpointInfo& operator=(const TCPEndpointInfo&) = delete;

Expand Down Expand Up @@ -179,6 +180,7 @@ namespace Ice
class ICE_API UDPEndpointInfo final : public IPEndpointInfo
{
public:
~UDPEndpointInfo() final;
UDPEndpointInfo(const UDPEndpointInfo&) = delete;
UDPEndpointInfo& operator=(const UDPEndpointInfo&) = delete;

Expand Down Expand Up @@ -216,6 +218,7 @@ namespace Ice
class ICE_API WSEndpointInfo final : public EndpointInfo
{
public:
~WSEndpointInfo() final;
WSEndpointInfo(const WSEndpointInfo&) = delete;
WSEndpointInfo& operator=(const WSEndpointInfo&) = delete;

Expand All @@ -240,6 +243,7 @@ namespace Ice
class ICE_API OpaqueEndpointInfo final : public EndpointInfo
{
public:
~OpaqueEndpointInfo() final;
OpaqueEndpointInfo(const OpaqueEndpointInfo&) = delete;
OpaqueEndpointInfo& operator=(const OpaqueEndpointInfo&) = delete;

Expand Down
1 change: 1 addition & 0 deletions cpp/include/Ice/SSL/EndpointInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace Ice::SSL
class ICE_API EndpointInfo final : public Ice::EndpointInfo
{
public:
~EndpointInfo() final;
EndpointInfo(const EndpointInfo&) = delete;
EndpointInfo& operator=(const EndpointInfo&) = delete;

Expand Down
1 change: 1 addition & 0 deletions cpp/include/Ice/ios/iAPEndpointInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace IceIAP
class EndpointInfo final : public Ice::EndpointInfo
{
public:
~EndpointInfo() final;
EndpointInfo(const EndpointInfo&) = delete;
EndpointInfo& operator=(const EndpointInfo&) = delete;

Expand Down
1 change: 1 addition & 0 deletions cpp/include/IceBT/EndpointInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace IceBT
class ICEBT_API EndpointInfo final : public Ice::EndpointInfo
{
public:
~EndpointInfo() final;
EndpointInfo(const EndpointInfo&) = delete;
EndpointInfo& operator=(const EndpointInfo&) = delete;

Expand Down
8 changes: 8 additions & 0 deletions cpp/src/Ice/EndpointI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ Ice::EndpointInfo::secure() const noexcept
return underlying ? underlying->secure() : false;
}

Ice::TCPEndpointInfo::~TCPEndpointInfo() {}

Ice::UDPEndpointInfo::~UDPEndpointInfo() {}

Ice::WSEndpointInfo::~WSEndpointInfo() {}

Ice::OpaqueEndpointInfo::~OpaqueEndpointInfo() {}

void
IceInternal::EndpointI::streamWrite(Ice::OutputStream* s) const
{
Expand Down
5 changes: 5 additions & 0 deletions cpp/src/Ice/SSL/SSLEndpointI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ Ice::SSL::OpenSSLConnectionInfo::~OpenSSLConnectionInfo()
}
#endif

Ice::SSL::EndpointInfo::~EndpointInfo()
{
// out of line to avoid weak vtable
}

Ice::SSL::EndpointI::EndpointI(const InstancePtr& instance, const IceInternal::EndpointIPtr& del)
: _instance(instance),
_delegate(del)
Expand Down
1 change: 1 addition & 0 deletions cpp/src/Ice/ios/iAPEndpointI.mm
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ ICEIAP_API void registerIceIAP(bool loadOnInitialize)

// Implement virtual destructors out of line to avoid weak vtables.
IceIAP::ConnectionInfo::~ConnectionInfo() {}
IceIAP::EndpointInfo::~EndpointInfo() {}

IceObjC::iAPEndpointI::iAPEndpointI(
const ProtocolInstancePtr& instance,
Expand Down
1 change: 1 addition & 0 deletions cpp/src/IceBT/EndpointI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ using namespace IceBT;

// Implement virtual destructors out of line to avoid weak vtables.
IceBT::ConnectionInfo::~ConnectionInfo() {}
IceBT::EndpointInfo::~EndpointInfo() {}

IceBT::EndpointI::EndpointI(
const InstancePtr& instance,
Expand Down

0 comments on commit fcb4343

Please sign in to comment.