microsoft / microsoft/Windows-classic-samples

Exception thrown: read access violation in ListViewSample

Open
#231 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
5.7k
Forks
3.3k
PR merge metrics
No merged PRs in 30d

Description

Windows-classic-samples/tree/main/Samples/Win7Samples/multimedia/Direct2D)/ListViewSample/


Exception thrown: read access violation.
this was 0x9B6800B0.


HRESULT ListViewApp::CreateDeviceResources()
{
HRESULT hr = S_OK;

if (!m_pRT)                 <<<-------------------------------------------------  Exception at this line in Visual Studio 2015/2019
{
    RECT rc;
    GetClientRect(m_d2dHwnd, &rc);

    D2D1_SIZE_U size = D2D1::SizeU(
        rc.right - rc.left,
        rc.bottom - rc.top
        );

    //create a D2D render target
    hr = m_pD2DFactory->CreateHwndRenderTarget(
        D2D1::RenderTargetProperties(),
        D2D1::HwndRenderTargetProperties(m_d2dHwnd, size),
        &m_pRT
        );
    if (SUCCEEDED(hr))
    {
        //create a black brush
        hr = m_pRT->CreateSolidColorBrush(
            D2D1::ColorF(D2D1::ColorF::Black),
            &m_pBlackBrush
            );
    }
    if (SUCCEEDED(hr))
    {
        hr = m_pRT->CreateBitmap(
            D2D1::SizeU(msc_atlasWidth, msc_atlasHeight),
            D2D1::BitmapProperties(D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED)),
            &m_pBitmapAtlas
            );
    }
    if (SUCCEEDED(hr))
    {
        hr = CreateBindCtx(0, &m_pBindContext);
    }
    if (SUCCEEDED(hr))
    {
        hr = LoadDirectory();
    }
}

return hr;

}


'ListViewSample.exe' (Win32): Loaded 'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.17763.2686_none_de755d285347a0fe\comctl32.dll'.
'ListViewSample.exe' (Win32): Loaded 'C:\Windows\System32\TextInputFramework.dll'.
'ListViewSample.exe' (Win32): Loaded 'C:\Windows\System32\CoreMessaging.dll'.
'ListViewSample.exe' (Win32): Loaded 'C:\Windows\System32\CoreUIComponents.dll'.
'ListViewSample.exe' (Win32): Loaded 'C:\Windows\System32\ntmarta.dll'.
'ListViewSample.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'.
'ListViewSample.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'.
'ListViewSample.exe' (Win32): Unloaded 'C:\Windows\System32\WinTypes.dll'
'ListViewSample.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'.
'ListViewSample.exe' (Win32): Unloaded 'C:\Windows\System32\WinTypes.dll'
Exception thrown: read access violation.
this was 0x9B6800B0.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Windows-classic-samples/tree/main/Samples/Win7Samples/multimedia/Direct2D)/ListViewSample/ and inspect ListViewApp::CreateDeviceResources(). Reproduce the read access violation in Visual Studio at the marked line, then trace the failing object state and verify that the sample runs without the exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.