summaryrefslogtreecommitdiffstats
path: root/chrome_frame/find_dialog.cc
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-12 17:49:35 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-12 17:49:35 +0000
commitb0febbf8b696aa9d884467a34842411c5301837e (patch)
tree8daaf1ab2567ce20fdfa771f0daf41a91c6edb5c /chrome_frame/find_dialog.cc
parentd56127cc3bf41ae4df9a5586f132d02cc6917cfd (diff)
downloadchromium_src-b0febbf8b696aa9d884467a34842411c5301837e.zip
chromium_src-b0febbf8b696aa9d884467a34842411c5301837e.tar.gz
chromium_src-b0febbf8b696aa9d884467a34842411c5301837e.tar.bz2
The ChromeFrameAutomationClient class needs to be refcounted as it implements the PluginRequestHandler
interface which is maintained by individual requests which can outlive the active document/activex instances. I ran into a crash where UrlmonUrlRequest was calling into an invalid PluginRequestHandler pointer which had been destroyed just before. We also need to ensure that UrlmonUrlRequest and ChromeFrameActiveXBase select the multi threaded model as AddRef/Release can be invoked from multiple threads. I also removed the CleanupAsyncRequests function in ChromeFrameAutomationClient and moved all the code to CleanupRequests, which ensures that we treat synchronous and asynchronous requests similarly. There are instances where an automation client instance is created and destroyed without being initialized which causes a spurious assert to fire in the Uninitialize function. I added a check in the Uninitialize function to return if the state is uninitialized. Bug=none Review URL: http://codereview.chromium.org/386014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31792 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/find_dialog.cc')
-rw-r--r--chrome_frame/find_dialog.cc42
1 files changed, 21 insertions, 21 deletions
diff --git a/chrome_frame/find_dialog.cc b/chrome_frame/find_dialog.cc
index 15aaff7..eddfc81 100644
--- a/chrome_frame/find_dialog.cc
+++ b/chrome_frame/find_dialog.cc
@@ -50,7 +50,7 @@ LRESULT CFFindDialog::OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl,
LRESULT CFFindDialog::OnInitDialog(UINT msg, WPARAM wparam, LPARAM lparam,
BOOL& handled) {
// Init() must be called before Create() or DoModal()!
- DCHECK(automation_client_);
+ DCHECK(automation_client_.get());
InstallMessageHook();
SendDlgItemMessage(IDC_FIND_TEXT, EM_EXLIMITTEXT, 0, kMaxFindChars);
@@ -67,32 +67,32 @@ LRESULT CALLBACK CFFindDialog::GetMsgProc(int code, WPARAM wparam,
LPARAM lparam) {
// Mostly borrowed from http://support.microsoft.com/kb/q187988/
// and http://www.codeproject.com/KB/atl/cdialogmessagehook.aspx.
- LPMSG msg = reinterpret_cast<LPMSG>(lparam);
- if (code >= 0 && wparam == PM_REMOVE &&
- msg->message >= WM_KEYFIRST && msg->message <= WM_KEYLAST) {
- HWND hwnd = GetActiveWindow();
- if (::IsWindow(hwnd) && ::IsDialogMessage(hwnd, msg)) {
- // The value returned from this hookproc is ignored, and it cannot
- // be used to tell Windows the message has been handled. To avoid
- // further processing, convert the message to WM_NULL before
- // returning.
- msg->hwnd = NULL;
- msg->message = WM_NULL;
- msg->lParam = 0L;
- msg->wParam = 0;
- }
- }
-
- // Passes the hook information to the next hook procedure in
- // the current hook chain.
+ LPMSG msg = reinterpret_cast<LPMSG>(lparam);
+ if (code >= 0 && wparam == PM_REMOVE &&
+ msg->message >= WM_KEYFIRST && msg->message <= WM_KEYLAST) {
+ HWND hwnd = GetActiveWindow();
+ if (::IsWindow(hwnd) && ::IsDialogMessage(hwnd, msg)) {
+ // The value returned from this hookproc is ignored, and it cannot
+ // be used to tell Windows the message has been handled. To avoid
+ // further processing, convert the message to WM_NULL before
+ // returning.
+ msg->hwnd = NULL;
+ msg->message = WM_NULL;
+ msg->lParam = 0L;
+ msg->wParam = 0;
+ }
+ }
+
+ // Passes the hook information to the next hook procedure in
+ // the current hook chain.
return ::CallNextHookEx(msg_hook_, code, wparam, lparam);
}
bool CFFindDialog::InstallMessageHook() {
// Make sure we only call this once.
DCHECK(msg_hook_ == NULL);
- msg_hook_ = ::SetWindowsHookEx(WH_GETMESSAGE, &CFFindDialog::GetMsgProc,
- _AtlBaseModule.m_hInst, GetCurrentThreadId());
+ msg_hook_ = ::SetWindowsHookEx(WH_GETMESSAGE, &CFFindDialog::GetMsgProc,
+ _AtlBaseModule.m_hInst, GetCurrentThreadId());
DCHECK(msg_hook_ != NULL);
return msg_hook_ != NULL;
}