Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Winapi RDP上的Direct2D泄漏_Winapi_Rdp_Direct2d - Fatal编程技术网

Winapi RDP上的Direct2D泄漏

Winapi RDP上的Direct2D泄漏,winapi,rdp,direct2d,Winapi,Rdp,Direct2d,这是一种奇怪的行为,我需要你的经验 我有一个Direct2D应用程序,它以一种典型的方式绘制屏幕: // fact,draw global factory and ID2D1RenderTarget, WM_PAINT creates them once. case WM_PAINT: { PAINTSTRUCT ps; BeginPaint(hWnd, &ps); RECT rc = {}; GetClientRect(hWnd, &rc);

这是一种奇怪的行为,我需要你的经验

我有一个Direct2D应用程序,它以一种典型的方式绘制屏幕:

// fact,draw global factory and ID2D1RenderTarget, WM_PAINT creates them once.

case WM_PAINT:
{
    PAINTSTRUCT ps;
    BeginPaint(hWnd, &ps);

    RECT rc = {};
    GetClientRect(hWnd, &rc);
    if (!fact)
        D2D1CreateFactory(D2D1_FACTORY_TYPE::D2D1_FACTORY_TYPE_MULTI_THREADED, &fact);
    if (!draw)
    {
        D2D1_HWND_RENDER_TARGET_PROPERTIES hp;
        hp.hwnd = hWnd;
        hp.pixelSize.width = rc.right;
        hp.pixelSize.height = rc.bottom;
        fact->CreateHwndRenderTarget(D2D1::RenderTargetProperties(), D2D1::HwndRenderTargetProperties(hWnd, D2D1::SizeU(rc.right - rc.left, rc.bottom - rc.top)), &draw);
    }
    draw->BeginDraw();
    .. more paint
    draw->EndDraw();
    EndPaint(hWnd, &ps);
    return 0;
}
此应用程序还有一个自调试库,其中显示应用程序创建的句柄数。 当应用程序在本地运行时,没有问题,句柄的数量保持不变

在远程桌面上运行应用程序时,我每秒可以多获得10个句柄。当应用程序运行几分钟时,我得到10000个句柄

进一步的调试表明,在
ID2D1RenderTarget::BeginDraw()
EndDraw()
之间会发生泄漏,即使我没有绘制任何内容

有人经历过这样的问题吗?这是一个已知的bug吗?

validate直立(),请尝试使用此函数,BeginPaint函数将自动对所有客户端区域生效。系统将继续生成WM_PAINT消息,直到当前更新区域生效。ValidateBu立(),尝试使用此函数,BeginPaint函数将自动对所有客户端区域生效。系统继续生成WM_PAINT消息,直到当前更新区域生效。