多次加载页面后,MFC CDHtmlDialog挂起

时间:2017-04-11 23:08:24

标签: windows winapi visual-c++ mfc

标题说明了一切。我们的应用程序工作数小时或数天后,我在我们的自助服务终端应用程序中挂了一个挂机。我把它提炼到CDhtmlDialog的Navigate(),或者它做的任何事情。

Windows 10,Visual Studio 2013 Community Edition,共享DLL中的MFC

在基于CDHtmlDialog的模式对话框的新生成的基于MFC对话框的应用程序中重现了这个问题。

在该对话框中,我所做的就是设置一个定时器,每隔一秒左右调用一次以重新加载页面。这是计时器例程。

void CDHtmlStressDlg::OnTimer(UINT nIDEvent)
{
  Navigate(L"C:\\temp\\html\\test.html");
}

在几百到几千次加载(不确定)之后 - 整个UI冻结。如果我尝试将消息发布到窗口(这是我在旧应用程序中尝试过的) - 我收到错误1816 - (配额不够)。不知道它是否相关,只是我观察到的一件事。

这是挂起后的线程转储(注意,我不创建自己的任何线程,这是所有MFC的东西):

Not Flagged     764 0   Worker Thread   msvcrt.dll!_threadstartex   jscript9.dll!Event::Wait    Normal
Not Flagged     6368    0   Main Thread Main Thread mfc120ud.dll!51fbbc54   Normal
Not Flagged     7228    0   Worker Thread   ntdll.dll!TppWorkerThread   ntdll.dll!_NtWaitForWorkViaWorkerFactory@20 Normal
Not Flagged     7936    0   Worker Thread   ntdll.dll!TppWorkerThread   ntdll.dll!_NtWaitForWorkViaWorkerFactory@20 Normal
Not Flagged     4284    0   Worker Thread   ntdll.dll!TppWorkerThread   ntdll.dll!_NtWaitForWorkViaWorkerFactory@20 Normal
Not Flagged     7844    0   Worker Thread   msvcrt.dll!_threadstartex   mshtml.dll!Memory::Recycler::ThreadProc Below Normal
Not Flagged     7252    0   Worker Thread   mshtml.dll!CExecFT::StaticThreadProc()  mshtml.dll!Memory::HeapBucketT<Memory::SmallNormalHeapBlockT<SmallAllocationBlockAttributes> >::SweepBucket Normal
Not Flagged     7172    0   Worker Thread   ntdll.dll!TppWorkerThread   ntdll.dll!_NtWaitForWorkViaWorkerFactory@20 Normal
Not Flagged     7176    0   Worker Thread   mshtml.dll!CExecFT::StaticThreadProc()  mshtml.dll!CTimerMan::ThreadExec    Normal
Not Flagged     6252    0   Worker Thread   ntdll.dll!TppWorkerThread   ntdll.dll!_NtWaitForWorkViaWorkerFactory@20 Normal
Not Flagged     7812    0   Worker Thread   winmm.dll!mciwindow win32u.dll!_NtUserGetMessage@16 Highest
Not Flagged >   5836    0   Worker Thread   mshtml.dll!CExecFT::StaticThreadProc()  combase.dll!CCliModalLoop::BlockFn  Normal
Not Flagged     404 0   Worker Thread   mshtml.dll!CExecFT::StaticThreadProc()  combase.dll!CCliModalLoop::BlockFn  Normal
Not Flagged     6920    0   Worker Thread   msvcrt.dll!_threadstartex   jscript9.dll!Recycler::ThreadProc   Below Normal

这是我正在加载的HTML

<!DOCTYPE html>
<html>
<head>
    <style>
        body {
            overflow: hidden; /*suppress scroll bars*/
        }

        .box {
            display: inline-block;
            border-spacing: 0;
            border-collapse: collapse;
            font-family: Arial;
            transform: rotate(90deg);
            display: inline-block;
        }

        .line1 {
            font-size: 210%; 
            color: Coral;
            width: 1100px;
            transform: translate(45%, 1120%); 
            text-align: center;
        }

        .pic1 {            
            width: 230px;
            transform: translate(0%, -30px);
        }
    </style>
</head>

<body id=CHtmlMirror bgcolor=black>

    <div class="box">
        <div class="line1">Test Line to load</div>
    </div>

    <table border=0 class="pictureTable">
        <tr><td><p><img class="pic1" src=file://c:/temp/icons/pic1.jpg></p></td></tr>
    </table>

</body>
</html>

1 个答案:

答案 0 :(得分:0)

只有在从外部应用程序(或线程无关紧要)修改正在加载的HTML页面时,此问题才可重现。在这种情况下没有加载错误 - 只是“终端案例”UI冻结。

要解决此问题,我们确保在开始加载文件时没有人可以触摸该文件。一旦确保这一点,挂起就无法再现。