diff options
-rw-r--r-- | base/scoped_comptr_win.h | 3 | ||||
-rw-r--r-- | base/scoped_comptr_win_unittest.cc | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/base/scoped_comptr_win.h b/base/scoped_comptr_win.h index d627223..9ba0b84 100644 --- a/base/scoped_comptr_win.h +++ b/base/scoped_comptr_win.h @@ -138,6 +138,9 @@ class ScopedComPtr : public scoped_refptr<Interface> { return reinterpret_cast<BlockIUnknownMethods<Interface>*>(ptr_); } + // Pull in operator=() from the parent class. + using scoped_refptr<Interface>::operator=; + // static methods static const IID& iid() { diff --git a/base/scoped_comptr_win_unittest.cc b/base/scoped_comptr_win_unittest.cc index 96ebcc6..5e4ad3d 100644 --- a/base/scoped_comptr_win_unittest.cc +++ b/base/scoped_comptr_win_unittest.cc @@ -29,6 +29,11 @@ TEST(ScopedComPtrTest, ScopedComPtr) { EXPECT_TRUE(copy1.IsSameObject(mem_alloc)); EXPECT_FALSE(copy1.IsSameObject(unk2)); // unk2 is valid but different EXPECT_FALSE(copy1.IsSameObject(unk)); // unk is NULL + + IMalloc* naked_copy = copy1.Detach(); + copy1 = naked_copy; // Test the =(T*) operator. + naked_copy->Release(); + copy1.Release(); EXPECT_FALSE(copy1.IsSameObject(unk2)); // unk2 is valid, copy1 is not |