From 972e966190a5560d15e5e0f26f10fd87d14ab735 Mon Sep 17 00:00:00 2001 From: Steve Workman Date: Wed, 9 Jul 2014 11:02:06 -0700 Subject: [PATCH] Bug 1036056 - Remove dangerous public destructor of nsFileUploadContentStream r=mcmanus --- netwerk/protocol/file/nsFileChannel.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/netwerk/protocol/file/nsFileChannel.cpp b/netwerk/protocol/file/nsFileChannel.cpp index 93840f5755c4..e2ed0b7362ad 100644 --- a/netwerk/protocol/file/nsFileChannel.cpp +++ b/netwerk/protocol/file/nsFileChannel.cpp @@ -178,20 +178,14 @@ public: uint32_t count, nsIEventTarget *target); private: + virtual ~nsFileUploadContentStream() {} + void OnCopyComplete(); nsRefPtr mCopyEvent; nsCOMPtr mSink; }; -namespace mozilla { -template<> -struct HasDangerousPublicDestructor -{ - static const bool value = true; -}; -} - NS_IMPL_ISUPPORTS_INHERITED0(nsFileUploadContentStream, nsBaseContentStream) @@ -365,14 +359,13 @@ nsFileChannel::OpenContentStream(bool async, nsIInputStream **result, if (NS_FAILED(rv)) return rv; - nsFileUploadContentStream *uploadStream = + nsRefPtr uploadStream = new nsFileUploadContentStream(async, fileStream, mUploadStream, mUploadLength, this); if (!uploadStream || !uploadStream->IsInitialized()) { - delete uploadStream; return NS_ERROR_OUT_OF_MEMORY; } - stream = uploadStream; + stream = uploadStream.forget(); mContentLength = 0;