locked
clr!SafeReleasePreemp() crash while deleting C# object from C++ application RRS feed

  • Question

  • i have a C# Managed.dll and it is loading in C++ App using CWnd::CreateControl(). In C++ app its creation and destruction is done as follows

    void MyDlg::Initialize()
    {
    	m_pManagedCtrl = new ManagedCtrl();// C# control
    	m_pManagedCtrl->Create("Sample.ManagedControl", dwStyle, Rect, this, 111111);
    }
    
    void  MyDlg::UnInitialize()
    {
    	m_pManagedCtrl->DestroyWindow();
    	delete m_pManagedCtrl;
    	m_pManagedCtrl = NULL;
    }

    Is it the correct way. Some time i am getting crashes in clr!SafeReleasePreemp() while closing MyDlg. 


    Thanks, Renjith V R

    Thursday, April 27, 2017 1:37 PM

Answers