Search

Crash in AdjustLayout using CMFCPropertyGridCtrl by Dominic Amann

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 679332
Opened: 7/13/2011 12:42:45 PM
Access Restriction: Public
1
Workaround(s)
0
User(s) can reproduce this bug
When using a CMFCPropertyGridCtrl, "selecting" a child item, then deleting the parent using DeleteProperty, then adding a new property and calling AdjustLayout triggers a crash, as the m_pSel pointer within the CMFCPropertyGridCtrl is now dangling.

I can work around this by calling SetCurSel(0) after deleting a parent object.
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling version

Visual Studio 2010

Steps to reproduce

void CPositioningWnd::TestList()
{
    CMFCPropertyGridProperty* parent = new CMFCPropertyGridProperty("Parent");
    m_wndPropList.AddProperty(parent, 0, 0);
    CMFCPropertyGridProperty* child = new CSSIPropertyGridProperty("Child label", _T(0.0), "Help for label", 12);
    parent->AddSubItem(child);
    m_wndPropList.AdjustLayout();
    
    m_wndPropList.SetCurSel(child);

    m_wndPropList.DeleteProperty(parent, 0, 0);

    parent = new CMFCPropertyGridProperty("New Parent");
    m_wndPropList.AddProperty(parent);    // crash here in AdjustLayout
    child = new CSSIPropertyGridProperty("New child label", _T(0.0), "Help for label", 12);
    parent->AddSubItem(child);
    m_wndPropList.AdjustLayout();
}

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

ASSERT_VALID fails with illegal vtable pointer

Expected results

m_pSel should be cleared if in a child of the deleted object.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 5/10/2012 at 5:59 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Dominic Amann on 7/15/2011 at 7:51 AM
Sorry - given work demands (late project) and the fact I have identified a work around, I cannot justify the hour or so to create a demo project for this.
Posted by MS-Moderator08 on 7/13/2011 at 10:17 PM
Thank you for reporting this issue. Could you please attach a demo project to help us reproduce this issue?
Posted by MS-Moderator01 on 7/13/2011 at 12:50 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by Dominic Amann on 7/13/2011 at 12:43 PM
Calling SetCurSel(0) after deleting the item allows me to work.