diff options
author | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-16 22:17:05 +0000 |
---|---|---|
committer | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-16 22:17:05 +0000 |
commit | 13897f5adc091bdb1000e61fcec730cfcfd53a9f (patch) | |
tree | 97e895ba4069b03b898c013c27be04a23881cde1 /chrome/browser/views/tab_contents | |
parent | 9393d635e9e49f21631fca011d87ac7be1b19d23 (diff) | |
download | chromium_src-13897f5adc091bdb1000e61fcec730cfcfd53a9f.zip chromium_src-13897f5adc091bdb1000e61fcec730cfcfd53a9f.tar.gz chromium_src-13897f5adc091bdb1000e61fcec730cfcfd53a9f.tar.bz2 |
Fix 2 drag-out problems:
1) Does not work if dragging out to XP desktop. We need to return an error code
when waiting for XP Shell to start a background thread.
2) Occasional crash due to regression caused by r43726. Fix it by holding a
local reference to drag_source_.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/1619023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44833 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/tab_contents')
-rw-r--r-- | chrome/browser/views/tab_contents/tab_contents_drag_win.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/chrome/browser/views/tab_contents/tab_contents_drag_win.cc b/chrome/browser/views/tab_contents/tab_contents_drag_win.cc index 21fc9fd..37bebf5 100644 --- a/chrome/browser/views/tab_contents/tab_contents_drag_win.cc +++ b/chrome/browser/views/tab_contents/tab_contents_drag_win.cc @@ -284,17 +284,22 @@ void TabContentsDragWin::DoDragging(const WebDropData& drop_data, data.SetString(drop_data.plain_text); } + // Keep a local reference to drag_source_ in case that EndDragging is called + // before DoDragDrop returns. + scoped_refptr<WebDragSource> drag_source(drag_source_); + // We need to enable recursive tasks on the message loop so we can get // updates while in the system DoDragDrop loop. bool old_state = MessageLoop::current()->NestableTasksAllowed(); - DWORD effect; MessageLoop::current()->SetNestableTasksAllowed(true); + DWORD effect; DoDragDrop(OSExchangeDataProviderWin::GetIDataObject(data), drag_source_, web_drag_utils_win::WebDragOpMaskToWinDragOpMask(ops), &effect); + MessageLoop::current()->SetNestableTasksAllowed(old_state); + // This works because WebDragSource::OnDragSourceDrop uses PostTask to // dispatch the actual event. - drag_source_->set_effect(effect); - MessageLoop::current()->SetNestableTasksAllowed(old_state); + drag_source->set_effect(effect); } void TabContentsDragWin::EndDragging(bool restore_suspended_state) { |