Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Using a CExtControlBar object within a AFX Ext DLL built in Release cuases a crash on Exit Collapse All
Subject Author Date
Robert Nitzel Mar 20, 2007 - 11:46 AM

We are currently using AFX DLLs for a plug-in based system for an MDI application using prof-uis.

At the present we Pass the tool a CExtControlBar * pToolDockBar that the dll docks a CExtControlBar allocated within the dll.

Here is the code list for our InitTool() function within the DLL:

void InitTool(CWnd *pParent, CExtControlBar * pToolDockBar, int _ToolLayer)
{

    HINSTANCE hOld = AfxGetResourceHandle();
    AfxSetResourceHandle(TESTDLL.hModule);


    
    mpParent = pParent;

    ToolLayer = _ToolLayer;


    
//Load the Tool Bar-
    /*
    if( 0 == m_TESTToolBar.Create(_T("Test Plugin"),
                            mpParent,
                            0xE822, //AFX_IDW_TOOLBAR
                            WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_DYNAMIC
                            | CBRS_TOOLTIPS
                            | CBRS_HIDE_INPLACE
                            ) ||
                            0 == m_TESTToolBar.LoadToolBar( ID_TEST_TOOLBAR ))
    {
        TRACE0("FAILED to create toolbar\n");
        AfxSetResourceHandle(hOld);
        return;
    }



    //Dock the toolbar
    m_TESTToolBar.EnableDocking( CBRS_ALIGN_ANY );
    ((CMDIFrameWnd *)pParent)->DockControlBar(&m_TESTToolBar);
*/
//Load Dialog Bar


    if(0 == m_wndTestDlgControlBar.Create(_T("TSI Docked Tool"),
            mpParent,
            IDD_TEST_DLG_BAR,
            WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER
                |CBRS_TOOLTIPS
                |CBRS_FLYBY
                |CBRS_SIZE_DYNAMIC
                |CBRS_HIDE_INPLACE )
            )
    {
        TRACE0("Failed to Create a Diaglog Bar\n");
        AfxSetResourceHandle(hOld);
        return;

    }


    //Now create it on the screen
    if(0 == mpDlgBar.Create(mpDlgBar.IDD, &m_wndTestDlgControlBar))
    {
        delete mpDlgBar;
        TRACE0("Failed to create Dialog \n");
        AfxSetResourceHandle(hOld);
        return;        // fail to create
    }

    //Dock the dialog control bar
    m_wndTestDlgControlBar.EnableDocking( CBRS_ALIGN_ANY );
    //Dock the Tool Created CExtControlBar to the ControlBar passed to the tool from the main
    //application.
    pToolDockBar->DockControlBarIntoTabbedContainer(&m_wndTestDlgControlBar,0);
    
AfxSetResourceHandle(hOld);
    
    return;
}


This works fine in debug build, however in Release build, when we call AfxFreeLibrary() we get a
"R6025 -Pure virtual function call" Error.


Technical Support Mar 20, 2007 - 12:46 PM

It seems the problem is somewhere in the shutdown code, not in the code that creates the toolbar. We recommend you debug the release version of your application and plugin DLLs. You should change compiler and linker settings for these projects in the release configuration so that the degug information will be available. Please note that this kind of release build is not the same as the debug build because uninitialized variables are not be filled with zero bytes in it as it is in the classic release build.