summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-22 04:07:18 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-22 04:07:18 +0000
commit1264b8bdf52d38e7a32b7b7de9737ea0a307bdd7 (patch)
treed74970168084856e7b57e9eea51b9dcd55ff9815
parent2ce680b238e4a7d848b9bd05bb228d8da5ff2a9d (diff)
downloadchromium_src-1264b8bdf52d38e7a32b7b7de9737ea0a307bdd7.zip
chromium_src-1264b8bdf52d38e7a32b7b7de9737ea0a307bdd7.tar.gz
chromium_src-1264b8bdf52d38e7a32b7b7de9737ea0a307bdd7.tar.bz2
Fixes leak in drag_utils.
BUG=none TEST=none R=ben@chromium.org,tony@chromium.org Review URL: http://codereview.chromium.org/7215022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89975 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--views/drag_utils_win.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/views/drag_utils_win.cc b/views/drag_utils_win.cc
index 8a6f4ab..07905cb 100644
--- a/views/drag_utils_win.cc
+++ b/views/drag_utils_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,6 +8,7 @@
#include <shlobj.h>
#include <shobjidl.h>
+#include "base/win/scoped_comptr.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/dragdrop/os_exchange_data_provider_win.h"
@@ -24,9 +25,9 @@ static void SetDragImageOnDataObject(HBITMAP hbitmap,
const gfx::Size& size,
const gfx::Point& cursor_offset,
IDataObject* data_object) {
- IDragSourceHelper* helper = NULL;
+ base::win::ScopedComPtr<IDragSourceHelper> helper;
HRESULT rv = CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER,
- IID_IDragSourceHelper, reinterpret_cast<LPVOID*>(&helper));
+ IID_IDragSourceHelper, helper.ReceiveVoid());
if (SUCCEEDED(rv)) {
SHDRAGIMAGE sdi;
sdi.sizeDragImage = size.ToSIZE();
@@ -35,7 +36,7 @@ static void SetDragImageOnDataObject(HBITMAP hbitmap,
sdi.ptOffset = cursor_offset.ToPOINT();
helper->InitializeFromBitmap(&sdi, data_object);
}
-};
+}
// Blit the contents of the canvas to a new HBITMAP. It is the caller's
// responsibility to release the |bits| buffer.