summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-19 01:57:41 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-19 01:57:41 +0000
commitbcfb4a1f10406c9d4b5df0001718aa768cdaa171 (patch)
tree993e278cfadf99f97c540b662607208af8aa622d /chrome/browser
parent1e63ef067c3c5053587a8cfe58bb46076ee86c3c (diff)
downloadchromium_src-bcfb4a1f10406c9d4b5df0001718aa768cdaa171.zip
chromium_src-bcfb4a1f10406c9d4b5df0001718aa768cdaa171.tar.gz
chromium_src-bcfb4a1f10406c9d4b5df0001718aa768cdaa171.tar.bz2
Fix a Chrome crash caused in a ChromeFrame instance while displaying the inspector window. The inspector window uses the browser view
which instantiates the whole view including the ToolBar, which in turn instantiates the Autocomplete edit bar which uses Richedit on Windows. The auto complete edit bar dynamically loads and unloads the richedit control and it uses ATL to superclass the richedit control. If the rich edit dll loads at a different base address it causes a crash in Chrome while creating the window as ATL caches the wndproc address for a class. Fix is to setup an implicit dependency on the riched20.dll and not load and free it all the time. To achieve this we use #pragma comment for the riched20.lib and a dummy call to the CreateTextServices function exported by the dll to ensure that the linker does not discard the import. Fixes bug http://code.google.com/p/chromium/issues/detail?id=33308 Bug=33308 Review URL: http://codereview.chromium.org/646043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39415 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_win.cc16
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_win.h6
2 files changed, 10 insertions, 12 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
index 14ea78f..b39c6f0 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
@@ -1,10 +1,12 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
#include "chrome/browser/autocomplete/autocomplete_edit_view_win.h"
#include <locale>
+#include <richedit.h>
+#include <textserv.h>
#include "app/clipboard/clipboard.h"
#include "app/clipboard/scoped_clipboard_writer.h"
@@ -48,6 +50,7 @@
#include "views/widget/widget.h"
#pragma comment(lib, "oleacc.lib") // Needed for accessibility support.
+#pragma comment(lib, "riched20.lib") // Needed for the richedit control.
///////////////////////////////////////////////////////////////////////////////
// AutocompleteEditModel
@@ -405,8 +408,11 @@ AutocompleteEditViewWin::AutocompleteEditViewWin(
drop_highlight_position_(-1),
background_color_(0),
scheme_security_level_(ToolbarModel::NORMAL),
- text_object_model_(NULL),
- riched20dll_handle_(LoadLibrary(L"riched20.dll")) {
+ text_object_model_(NULL) {
+ // Dummy call to a function exported by riched20.dll to ensure it sets up an
+ // import dependency on the dll.
+ CreateTextServices(NULL, NULL, NULL);
+
model_->SetPopupModel(popup_view_->GetModel());
saved_selection_for_focus_change_.cpMin = -1;
@@ -475,10 +481,6 @@ AutocompleteEditViewWin::~AutocompleteEditViewWin() {
// released, it becomes garbage.
text_object_model_->Release();
- // We're now done with this library, so release our reference to it so it can
- // be unloaded if possible.
- FreeLibrary(riched20dll_handle_);
-
// We balance our reference count and unpatch when the last instance has
// been destroyed. This prevents us from relying on the AtExit or static
// destructor sequence to do our unpatching, which is generally fragile.
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.h b/chrome/browser/autocomplete/autocomplete_edit_view_win.h
index 393ef0a..4db0ea6 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -488,10 +488,6 @@ class AutocompleteEditViewWin
// Instance of accessibility information and handling.
mutable ScopedComPtr<IAccessible> autocomplete_accessibility_;
- // We explicitly retain a handle to this library so it never gets unloaded out
- // from underneath us.
- HMODULE riched20dll_handle_;
-
DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewWin);
};