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 » CExtCmdProfile::SerializeState problem/question Collapse All
Subject Author Date
Offer Har Mar 5, 2009 - 5:46 PM

Dear Support,


We’ve been having sporadic crashes in this function when loading UI states for a long time, and we think that we understand the reason, but we still need your help to realy understand what is happening.


This is the location of the crash in the function CExtCmdProfile::SerializeState, lines 1860 onwards:



            ...
            for( ; true; )
            {
                UINT nCmdId, nUsageTickCount;
                ar >> dwTmp;
                nCmdId = UINT(dwTmp);
                if( nCmdId == 0 )
                    break;
                ar >> dwTmp;
                nUsageTickCount = UINT(dwTmp);
                CExtCmdItem * pCmdItem = CmdGetPtr(nCmdId);
                ...

What we see is that the function CmdGetPtr returns NULL.


We see that this happens when the application was running and the user selected a command from a popup menu, this command, for some reason was saved in the serialized data, and the next time we load the application, it crashes.


We updated the function to skip these commands:



                if (NULL==pCmdItem)
                {
                    continue;
                }

And everything seems to run file now.


Can you please explain why this happens?


Thanks,


Ron.


 

Technical Support Mar 10, 2009 - 5:41 AM

Yes, this NULL checking code is only the not to crash solution. You should check whether the command manager is really updated from all the toolbar and menu resources in your project. Additionally, if you are registering/allocating some of command identifiers manually at run-time, then you should mark these commands as basic commands.

Technical Support Mar 9, 2009 - 11:42 AM

Please ensure you updated the command manager from all the menu and toolbar resources used in your application before loading command states. There is the common error is related to context popup menus based on menu resources: if you forgot to update the command manager from such menu resources, then it’s become updated later during menu initialization. This means command manager state loading and saving operates with different counts of registered commands. We added the NULL checking condition but we also left the NULL assertion.

Offer Har Mar 9, 2009 - 11:47 AM

Dear Support,


So I understand that skipping ’forgotten’ menus with the NULL checking will not harm the state loading? (I would like to replace only Prof-UIS DLL for existing customers...)


Thanks,


Ron.