Re: Help! my toolbar cause IE deadlock

From: wangzhong (wzhy2000_at_hotmail.com)
Date: 08/26/04

  • Next message: Jiangsheng[Microsoft MVP of VC++]: "Re: CHtmlView MDI + GetHtmlDocument + OLE Control = Assert Failure on close"
    Date: Fri, 27 Aug 2004 00:51:48 +0900
    
    

    I am sorry for my poor english.

    I have looked into some pages about LoaderLock, but I have no idea
    to slove this problem. i will describe it step by step.

    1) open IE browser.

    2) click to button in my toolbar, then login to my application server.
       --- Create some work threads to comunication with server
       --- Add the reference count of the work thread;
       --- Sink IWebBrowser/IHtmlWindow
       --- SetWindowsHookEx (GETMESSAGE, KEYBOARD, CALLWNDPROC )
       --- Create a hidden window to receive the message from the work thread.

    3) click a url to open a new browser
      --- Add the reference count of the work thread;
       ---Sink this browser(IWebBrowser/IHtmlWindow)
       ---Set WindowHook for this browser thread
       ---Create a hidden window for this browser.

    4) my plugin do som tasks, for examples
       --- In DWebBrowserEvents, navigation info is intercepted,
            then send it to server.
       --- In WH_CALLWNDPROC, get the active/inactive message,
            then send it to server.
       --- The hidden window can get WM_TIMER, then call IHTMLWindow's
            methods to check scroll range of every frame.

     5) close this new browser
       --- In IObjectWithSite::SetSite(NULL), destroy the hidden window,
            unsink IE interface, release WindowHook.
       --- Release the reference count of the work thread;

    6) do some loops from step 3) to step 5).

    7) In some circumstances, the IE hang. From the log, I can
         get the following infomation after SetSite(NULL) have been called.
       --- In the thread of the closed browser, SHDOCVW.DLL always locked
            "Critical secction"
       --- In the first browser, the hidden window got WM_Active/WM_Timer
    message.
            this thread finished this message, then was deadlock.
       --- The work thread which used COM, could use COM interface to
            send some messaes in 3-5 seconds, then was deadlock.
       --- The work thread which did not use COM is ok.

    I dont think that DLLMain maybe re-entry in my plug-in,
    when the new browser is closed, I keep all work threads alive,
    dont kill any thread.

    how about your thought?


  • Next message: Jiangsheng[Microsoft MVP of VC++]: "Re: CHtmlView MDI + GetHtmlDocument + OLE Control = Assert Failure on close"