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 » Assertions in CExtControlBar::ProfileBarStateLoad Collapse All
Subject Author Date
Patrick MITTON May 18, 2006 - 2:37 AM

In my application I have the same two asserts repeatedly when my application load reg infos with CExtControlBar::ProfileBarStateLoad
First one in CExtCustomizeCmdTreeNode::Serialize(....) line 2055
Second one in CExtCustomizeCmdTreeNode::InsertNode(.....) line 2820

When all assert are passed the application load positions correctly

Assert are only when registry is not empty. The same code works perfectly on other application without assert. Any idea of what occurs ?

I use the 2.53 commercial version of prof-uis

Technical Support May 18, 2006 - 4:04 AM

Both lines are assertion failures of this type:

ASSERT_KINDOF( CExtCustomizeCmdTreeNode, pNode );
Please let us know what is pNode in both cases. We think that the error with loading the state depends on the customize site initialization which may done incorrectly in your application. Please check this issue. If the problem persists, we will need to take look at your source code: send us your project or the source code of the main frame.

Patrick MITTON May 18, 2006 - 6:56 AM

pnode are CExtCustomizeCmdTreeNode objects. What kind of corect initialisation should I do on customize site ?

This is my oncreate method where I load registry (my mainframe sources are very long):

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CMyMDIFrameWndSizeDock::OnCreate(lpCreateStruct) == -1)
        return -1;
    
    CWinApp * pApp = ::AfxGetApp();
    ASSERT( pApp != NULL );
    ASSERT( pApp->m_pszRegistryKey != NULL );
    ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) );
    ASSERT( pApp->m_pszProfileName != NULL );
    ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) );

    ASSERT( pApp->m_pszProfileName != NULL );

    g_CmdManager->ProfileSetup(pApp->m_pszProfileName,GetSafeHwnd());
    
    VERIFY(g_CmdManager->UpdateFromMenu(pApp->m_pszProfileName, IDR_MAINFRAME));

    LitInfosFenetre();

m_wndMenuBar.SetMdiWindowPopupName( _T("Window") );
    if(!m_wndMenuBar.Create(_T("Menu"),     this,    ID_MENUBAR1))
    {
        TRACE0("Failed to create menubar\n");
        return -1;
    }
    if (!m_wndToolBar.Create(_T("Général"),this,ID_TOOLBAR1) ||
        !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
    {
        TRACE0("Failed to create toolbar\n");
        return -1; // fail to create
    }

    if (!m_wndControlsBar.Create(_T("Contrôles"),this, ID_TOOLBAR2) ||
        !m_wndControlsBar.LoadToolBar(IDR_TOOLBAR_CONTROLS))
    {
        TRACE0("Failed to create toolbar controls\n");
        return -1; // fail to create
    }

    if (!m_wndAlignementBar.Create(_T("Alignements"),this, ID_TOOLBAR3) ||
        !m_wndAlignementBar.LoadToolBar(IDR_TOOLBAR_ALIGNEMENTS))
    {
        TRACE0("Failed to create toolbar alignement\n");
        return -1; // fail to create
    }

    if (!m_wndBuildBar.Create(_T("Build"),this, ID_TOOLBAR4) ||
        !m_wndBuildBar.LoadToolBar(IDR_TOOLBAR_BUILD))
    {
        TRACE0("Failed to create toolbar build\n");
        return -1; // fail to create
    }

    if (!m_wndAffichageBar.Create(_T("Affichage"),this, ID_TOOLBAR5) ||
        !m_wndAffichageBar.LoadToolBar(IDR_TOOLBAR_AFFICHAGE))
    {
        TRACE0("Failed to create toolbar affichage\n");
        return -1; // fail to create
    }


    if (!m_wndParamBar.Create(_T("Paramétrage"),this,ID_TOOLBAR6) ||
        !m_wndParamBar.LoadToolBar(IDR_TOOLBAR_PARAM))
    {
        TRACE0("Failed to create toolbar Param\n");
        return -1; // fail to create
    }

    if (!m_wndStatusBar.Create(this) ||
        !m_wndStatusBar.SetIndicators(indicators,
         sizeof(indicators)/sizeof(UINT)))
    {
        TRACE0("Failed to create status bar\n");
        return -1; // fail to create
    }
    m_wndStatusBar.SetPaneInfo(1, ID_PANE_CURSOR, SBPS_NORMAL, 125);


    m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
    m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
    m_wndControlsBar.EnableDocking(CBRS_ALIGN_ANY);
    m_wndAlignementBar.EnableDocking(CBRS_ALIGN_ANY);
    m_wndBuildBar.EnableDocking(CBRS_ALIGN_ANY);
    m_wndAffichageBar.EnableDocking(CBRS_ALIGN_ANY);
    m_wndParamBar.EnableDocking(CBRS_ALIGN_ANY);

    if( !CExtControlBar::FrameEnableDocking(this) )
    {
        ASSERT( FALSE );
        return -1;
    }

    if(!CExtCustomizeSite::EnableCustomization(this, __ECSF_DEFAULT))
    {
        ASSERT( FALSE );
        return -1;
    }
    CExtCustomizeSite::CategoryUpdate( IDR_MAINFRAME );

    CExtCustomizeSite::CategoryMakeAllCmdsUnique();
    CExtCustomizeSite::CategoryAppendAllCommands();
    CExtCustomizeSite::CategoryAppendNewMenu();

    CExtCustomizeSite::CustomizeStateLoad(pApp->m_pszRegistryKey,pApp->m_pszProfileName,pApp->m_pszProfileName);
    
    if(!CExtControlBar::ProfileBarStateLoad(this, pApp->m_pszRegistryKey, pApp->m_pszProfileName, pApp->m_pszProfileName, &m_dataFrameWP))
    {
        DockControlBar(&m_wndMenuBar);
        DockControlBar(&m_wndToolBar);
        DockControlBar(&m_wndAlignementBar);
        DockControlBar(&m_wndControlsBar);
        DockControlBar(&m_wndBuildBar);
        DockControlBar(&m_wndAffichageBar);
        DockControlBar(&m_wndParamBar);
    }
    g_CmdManager->SerializeState(pApp->m_pszProfileName, pApp->m_pszRegistryKey, pApp->m_pszProfileName, false);

    return 0;
}

Technical Support May 18, 2006 - 9:16 AM

The following part at the end of the CMainFrame::OnCreateMethod() listed in your message:

    if(!CExtCustomizeSite::EnableCustomization(this, __ECSF_DEFAULT)) 

    { 

        ASSERT( FALSE ); 

        return -1; 

    }

    CExtCustomizeSite::CategoryUpdate( IDR_MAINFRAME );

 

    CExtCustomizeSite::CategoryMakeAllCmdsUnique(); 

    CExtCustomizeSite::CategoryAppendAllCommands(); 

    CExtCustomizeSite::CategoryAppendNewMenu();

 

    CExtCustomizeSite::CustomizeStateLoad(pApp->m_pszRegistryKey,pApp->m_pszProfileName,pApp->m_pszProfileName);

    

    if(!CExtControlBar::ProfileBarStateLoad(this, pApp->m_pszRegistryKey, pApp->m_pszProfileName, pApp->m_pszProfileName, &m_dataFrameWP))

    {

        DockControlBar(&m_wndMenuBar);

        DockControlBar(&m_wndToolBar);

        DockControlBar(&m_wndAlignementBar);

        DockControlBar(&m_wndControlsBar);

        DockControlBar(&m_wndBuildBar);

        DockControlBar(&m_wndAffichageBar);

        DockControlBar(&m_wndParamBar);

    }

    g_CmdManager->SerializeState(pApp->m_pszProfileName, pApp->m_pszRegistryKey, pApp->m_pszProfileName, false);

 

    return 0;
actually should be replaced with
      g_CmdManager->SerializeState( // SHOULD BE MOVED UP INTO THIS PLACE

            pApp->m_pszProfileName,

            pApp->m_pszRegistryKey,

            pApp->m_pszProfileName,

            false

            );

      VERIFY( // YOU FORGOT THIS

            CExtCustomizeSite::MenuInfoAdd(

                  this,

                  _T("Default"),

                  IDR_MAINFRAME,

                  true

                  )

            );

      VERIFY( // YOU FORGOT THIS

            CExtCustomizeSite::MenuInfoLoadAccelTable(

                  _T("Default"),

                  IDR_MAINFRAME

                  )

            );

      (!CExtCustomizeSite::EnableCustomization(this, __ECSF_DEFAULT)) 

      {

      

      ASSERT( FALSE ); 

            return -1; 

      }

      CExtCustomizeSite::CategoryUpdate( IDR_MAINFRAME );

      CExtCustomizeSite::CategoryMakeAllCmdsUnique(); 

      CExtCustomizeSite::CategoryAppendAllCommands(); 

      CExtCustomizeSite::CategoryAppendNewMenu();

      CExtCustomizeSite::CustomizeStateLoad(pApp->m_pszRegistryKey,pApp->m_pszProfileName,pApp->m_pszProfileName);

      if(!CExtControlBar::ProfileBarStateLoad(this, pApp->m_pszRegistryKey, pApp->m_pszProfileName, pApp->m_pszProfileName, &m_dataFrameWP))

      {

            DockControlBar(&m_wndMenuBar);

            DockControlBar(&m_wndToolBar);

            DockControlBar(&m_wndAlignementBar);

            DockControlBar(&m_wndControlsBar);

            DockControlBar(&m_wndBuildBar);

            DockControlBar(&m_wndAffichageBar);

            DockControlBar(&m_wndParamBar);

      }

      g_CmdManager->SerializeState(pApp->m_pszProfileName, pApp->m_pszRegistryKey, pApp->m_pszProfileName, false);

      return 0;




Patrick MITTON May 18, 2006 - 10:05 AM

Now with the following code I have news asserts with empty registry in CExtCustomizeSite::MenuInfoAdd and CExtCustomizeSite::EnableCustomizationof my mainframe. News asserts appear in CExtCustomizeSite::CustomizeStateSave my DestroyWindow.
When there are information in registry, asserts in CExtCustomizeSite::CustomizeStateLoad are always here.

My new oncreate :


int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CMyMDIFrameWndSizeDock::OnCreate(lpCreateStruct) == -1)
        return -1;
    
    CWinApp * pApp = ::AfxGetApp();
    ASSERT( pApp != NULL );
    ASSERT( pApp->m_pszRegistryKey != NULL );
    ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) );
    ASSERT( pApp->m_pszProfileName != NULL );
    ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) );
    
    ASSERT( pApp->m_pszProfileName != NULL );
    
    g_CmdManager->ProfileSetup(pApp->m_pszProfileName,GetSafeHwnd());
    
    VERIFY(g_CmdManager->UpdateFromMenu(pApp->m_pszProfileName, IDR_MAINFRAME));
    
    //    LitInfosFenetre();
    
    //    m_wndMenuBar.SetMdiWindowPopupName( _T("Window") );
    if(!m_wndMenuBar.Create(_T("Menu"),     this,    ID_MENUBAR1))
    {
        TRACE0("Failed to create menubar\n");
        return -1;
    }
    if (!m_wndToolBar.Create(_T("Général"),this,ID_TOOLBAR1) ||
        !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
    {
        TRACE0("Failed to create toolbar\n");
        return -1; // fail to create
    }
    
    if (!m_wndControlsBar.Create(_T("Contrôles"),this, ID_TOOLBAR2) ||
        !m_wndControlsBar.LoadToolBar(IDR_TOOLBAR_CONTROLS))
    {
        TRACE0("Failed to create toolbar controls\n");
        return -1; // fail to create
    }
    
    if (!m_wndAlignementBar.Create(_T("Alignements"),this, ID_TOOLBAR3) ||
        !m_wndAlignementBar.LoadToolBar(IDR_TOOLBAR_ALIGNEMENTS))
    {
        TRACE0("Failed to create toolbar alignement\n");
        return -1; // fail to create
    }
    
    if (!m_wndBuildBar.Create(_T("Build"),this, ID_TOOLBAR4) ||
        !m_wndBuildBar.LoadToolBar(IDR_TOOLBAR_BUILD))
    {
        TRACE0("Failed to create toolbar build\n");
        return -1; // fail to create
    }
    
    if (!m_wndAffichageBar.Create(_T("Affichage"),this, ID_TOOLBAR5) ||
        !m_wndAffichageBar.LoadToolBar(IDR_TOOLBAR_AFFICHAGE))
    {
        TRACE0("Failed to create toolbar affichage\n");
        return -1; // fail to create
    }
    
    
    if (!m_wndParamBar.Create(_T("Paramétrage"),this,ID_TOOLBAR6) ||
        !m_wndParamBar.LoadToolBar(IDR_TOOLBAR_PARAM))
    {
        TRACE0("Failed to create toolbar Param\n");
        return -1; // fail to create
    }
    
    if (!m_wndStatusBar.Create(this) ||
        !m_wndStatusBar.SetIndicators(indicators,
        sizeof(indicators)/sizeof(UINT)))
    {
        TRACE0("Failed to create status bar\n");
        return -1; // fail to create
    }
    m_wndStatusBar.SetPaneInfo(1, ID_PANE_CURSOR, SBPS_NORMAL, 125);
    
    
    m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
    m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
    m_wndControlsBar.EnableDocking(CBRS_ALIGN_ANY);
    m_wndAlignementBar.EnableDocking(CBRS_ALIGN_ANY);
    m_wndBuildBar.EnableDocking(CBRS_ALIGN_ANY);
    m_wndAffichageBar.EnableDocking(CBRS_ALIGN_ANY);
    m_wndParamBar.EnableDocking(CBRS_ALIGN_ANY);
    
    if( !CExtControlBar::FrameEnableDocking(this) )
    {
        ASSERT( FALSE );
        return -1;
    }
    
    g_CmdManager->SerializeState(pApp->m_pszProfileName,pApp->m_pszRegistryKey,pApp->m_pszProfileName,false);
    VERIFY(CExtCustomizeSite::MenuInfoAdd(this,_T("Menu"),IDR_MAINFRAME,true));
    VERIFY(CExtCustomizeSite::MenuInfoLoadAccelTable(_T("Menu"),IDR_MAINFRAME));
    if(!CExtCustomizeSite::EnableCustomization(this, __ECSF_DEFAULT))
    {
        ASSERT( FALSE );
        return -1;
    }
    
    CExtCustomizeSite::CategoryUpdate( IDR_MAINFRAME );
    CExtCustomizeSite::CategoryMakeAllCmdsUnique();
    CExtCustomizeSite::CategoryAppendAllCommands();
    CExtCustomizeSite::CategoryAppendNewMenu();
    CExtCustomizeSite::CustomizeStateLoad(pApp->m_pszRegistryKey,pApp->m_pszProfileName,pApp->m_pszProfileName);
    
    if(!CExtControlBar::ProfileBarStateLoad(this, pApp->m_pszRegistryKey, pApp->m_pszProfileName, pApp->m_pszProfileName, &m_dataFrameWP))
    {
        DockControlBar(&m_wndMenuBar);
        DockControlBar(&m_wndToolBar);
        DockControlBar(&m_wndAlignementBar);
        DockControlBar(&m_wndControlsBar);
        DockControlBar(&m_wndBuildBar);
        DockControlBar(&m_wndAffichageBar);
        DockControlBar(&m_wndParamBar);
    }
    return 0;
}


And my DestroyWindow

BOOL CMainFrame::DestroyWindow()
{
    CWinApp * pApp = ::AfxGetApp();
    ASSERT( pApp != NULL );
    ASSERT( pApp->m_pszRegistryKey != NULL );
    ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) );
    ASSERT( pApp->m_pszProfileName != NULL );
    ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) );
    VERIFY( CExtCustomizeSite::CustomizeStateSave( pApp->m_pszRegistryKey, pApp->m_pszProfileName, pApp->m_pszProfileName));
    VERIFY(CExtControlBar::ProfileBarStateSave(this,pApp->m_pszRegistryKey,pApp->m_pszProfileName,pApp->m_pszProfileName,&m_dataFrameWP));
    VERIFY(g_CmdManager->SerializeState(pApp->m_pszProfileName,pApp->m_pszRegistryKey,pApp->m_pszProfileName,true));
    g_CmdManager->ProfileWndRemove( GetSafeHwnd() );
    return CMyMDIFrameWndSizeDock::DestroyWindow();
}

Patrick MITTON May 19, 2006 - 9:46 AM

Hy,

we found another thing which seem’s corrupted:
At CExtCustomizeCmdTreeNode::Serialize(....) line 2055
we found that we have two CRuntimeClass instance with the same m_lpszClassName "CExtCustomizeCmdTreeNode".
This is why the ASSERT is launch.

Have you ever seen something like this ? Have you an issue ?

To know: we have a ’big’ project including many dlls whith some linked with profuis

Technical Support May 20, 2006 - 8:45 AM

Your last versions of the CMainFrame::OnCreate() and CMainFrame::DestroyWindow() methods look absolutely correct. Please provide us with more details about your projects which depend on Prof-UIS. Please note, if some of your DLLs are regular DLLs, then they should use RDE configuration(s) of Prof-UIS. The errors described in your post may be caused by regular DLLs which are linked with a non-RDE Prof-UIS configuration. Any regular DLL based on Prof-UIS should have the __PROF_UIS_FOR_REGULAR_DLL symbol defined in the pre-processor settings of the regular DLL project.

Patrick MITTON May 22, 2006 - 2:02 AM

Thanks for your help!

One of my DLL was build without _MBCS and __PROF_UIS_FOR_REGULAR_DLL symbols. So two versions of profuis’s dll were loaded : ProfUIS250n.dll and ProfUIS250m.dll, and I haven’t seen it. Now it’s work perfectly.