mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-31 11:01:40 +00:00
Bug 1028588 - Fix dangerous public destructors in media/mtransport - r=abr
This commit is contained in:
parent
ff32bb14c1
commit
a8c323ccfd
@ -130,10 +130,6 @@ class NrSocket : public NrSocketBase,
|
||||
public nsASocketHandler {
|
||||
public:
|
||||
NrSocket() : fd_(nullptr) {}
|
||||
virtual ~NrSocket() {
|
||||
if (fd_)
|
||||
PR_Close(fd_);
|
||||
}
|
||||
|
||||
// Implement nsASocket
|
||||
virtual void OnSocketReady(PRFileDesc *fd, int16_t outflags);
|
||||
@ -165,6 +161,11 @@ public:
|
||||
virtual int read(void* buf, size_t maxlen, size_t *len);
|
||||
|
||||
private:
|
||||
virtual ~NrSocket() {
|
||||
if (fd_)
|
||||
PR_Close(fd_);
|
||||
}
|
||||
|
||||
DISALLOW_COPY_ASSIGN(NrSocket);
|
||||
|
||||
PRFileDesc *fd_;
|
||||
@ -202,7 +203,6 @@ public:
|
||||
NS_DECL_NSIUDPSOCKETINTERNAL
|
||||
|
||||
NrSocketIpc(const nsCOMPtr<nsIEventTarget> &main_thread);
|
||||
virtual ~NrSocketIpc() {};
|
||||
|
||||
// Implementations of the NrSocketBase APIs
|
||||
virtual int create(nr_transport_addr *addr);
|
||||
@ -218,6 +218,8 @@ public:
|
||||
virtual int read(void* buf, size_t maxlen, size_t *len);
|
||||
|
||||
private:
|
||||
virtual ~NrSocketIpc() {};
|
||||
|
||||
DISALLOW_COPY_ASSIGN(NrSocketIpc);
|
||||
|
||||
// Main thread executors of the NrSocketBase APIs
|
||||
|
@ -97,7 +97,6 @@ class NrIceResolver
|
||||
transport_(transport),
|
||||
cb_(cb), cb_arg_(cb_arg),
|
||||
canceled_ (false) {}
|
||||
virtual ~PendingResolution(){};
|
||||
NS_IMETHOD OnLookupComplete(nsICancelable *request, nsIDNSRecord *record,
|
||||
nsresult status);
|
||||
int cancel();
|
||||
@ -105,6 +104,7 @@ class NrIceResolver
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
||||
private:
|
||||
virtual ~PendingResolution(){};
|
||||
nsCOMPtr<nsIEventTarget> thread_;
|
||||
uint16_t port_;
|
||||
int transport_;
|
||||
|
@ -81,12 +81,12 @@ class STUNUDPSocketFilter : public nsIUDPSocketFilter {
|
||||
: white_list_(),
|
||||
pending_requests_() {}
|
||||
|
||||
virtual ~STUNUDPSocketFilter() {}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIUDPSOCKETFILTER
|
||||
|
||||
private:
|
||||
virtual ~STUNUDPSocketFilter() {}
|
||||
|
||||
bool filter_incoming_packet(const mozilla::net::NetAddr *remote_addr,
|
||||
const uint8_t *data,
|
||||
uint32_t len);
|
||||
|
@ -12,9 +12,10 @@
|
||||
|
||||
class nsStunUDPSocketFilterHandler : public nsIUDPSocketFilterHandler {
|
||||
public:
|
||||
virtual ~nsStunUDPSocketFilterHandler() {}
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIUDPSOCKETFILTERHANDLER
|
||||
private:
|
||||
virtual ~nsStunUDPSocketFilterHandler() {}
|
||||
};
|
||||
|
||||
|
||||
|
@ -47,12 +47,13 @@ class SendPeriodic : public nsITimerCallback {
|
||||
SendPeriodic(TransportTestPeer *peer, int to_send) :
|
||||
peer_(peer),
|
||||
to_send_(to_send) {}
|
||||
virtual ~SendPeriodic() {}
|
||||
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
|
||||
protected:
|
||||
virtual ~SendPeriodic() {}
|
||||
|
||||
TransportTestPeer *peer_;
|
||||
int to_send_;
|
||||
};
|
||||
|
@ -109,7 +109,6 @@ class SocketHandler : public nsASocketHandler {
|
||||
public:
|
||||
SocketHandler(SocketTransportServiceTest *test) : test_(test) {
|
||||
}
|
||||
virtual ~SocketHandler() {}
|
||||
|
||||
void OnSocketReady(PRFileDesc *fd, int16_t outflags) {
|
||||
unsigned char buf[1600];
|
||||
@ -134,6 +133,9 @@ class SocketHandler : public nsASocketHandler {
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
protected:
|
||||
virtual ~SocketHandler() {}
|
||||
|
||||
private:
|
||||
SocketTransportServiceTest *test_;
|
||||
};
|
||||
|
@ -139,5 +139,13 @@ class TransportFlow : public nsISupports,
|
||||
nsCOMPtr<nsIEventTarget> target_;
|
||||
};
|
||||
|
||||
// Temporary whitelist for dangerous public destructors of reference-counted
|
||||
// classes. See Bug 1029478 for this occurrence.
|
||||
template<>
|
||||
struct HasDangerousPublicDestructor<TransportFlow>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
} // close namespace
|
||||
#endif
|
||||
|
@ -109,8 +109,6 @@ class TransportLayerLoopback : public TransportLayer {
|
||||
public:
|
||||
Deliverer(TransportLayerLoopback *layer) :
|
||||
layer_(layer) {}
|
||||
virtual ~Deliverer() {
|
||||
}
|
||||
void Detach() {
|
||||
layer_ = nullptr;
|
||||
}
|
||||
@ -119,6 +117,9 @@ class TransportLayerLoopback : public TransportLayer {
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
|
||||
private:
|
||||
virtual ~Deliverer() {
|
||||
}
|
||||
|
||||
DISALLOW_COPY_ASSIGN(Deliverer);
|
||||
|
||||
TransportLayerLoopback *layer_;
|
||||
|
@ -56,7 +56,6 @@ class TransportLayerPrsock : public TransportLayer {
|
||||
prsock_(prsock), fd_(fd) {
|
||||
mPollFlags = PR_POLL_READ;
|
||||
}
|
||||
virtual ~SocketHandler() {}
|
||||
|
||||
void Detach() {
|
||||
mCondition = NS_BASE_STREAM_CLOSED;
|
||||
@ -92,7 +91,8 @@ class TransportLayerPrsock : public TransportLayer {
|
||||
TransportLayerPrsock *prsock_;
|
||||
PRFileDesc *fd_;
|
||||
private:
|
||||
DISALLOW_COPY_ASSIGN(SocketHandler);
|
||||
DISALLOW_COPY_ASSIGN(SocketHandler);
|
||||
virtual ~SocketHandler() {}
|
||||
};
|
||||
|
||||
// Allow SocketHandler to talk to our APIs
|
||||
|
Loading…
x
Reference in New Issue
Block a user