Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - QAT crash due to CXTPRibbonGroupControlPopup::OnSe
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

QAT crash due to CXTPRibbonGroupControlPopup::OnSe

 Post Reply Post Reply
Author
Message
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 874
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Topic: QAT crash due to CXTPRibbonGroupControlPopup::OnSe
    Posted: 01 October 2009 at 5:14pm
I have a set of controls I put on a group. I then right-click the group and add the group to the QAT. Click the group on the QAT and it shows a popup with the controls that were on the group. So far so good.
 
I now proceed to unload the server that the controls were added for (it is an addin to my product). So I have to remove the controls I added to the ribbon.
 
So I call GetControls on the ribbon.  For each command the add-in added, I call FindControl in a while loop (loop is to try and account for copied controls). Each control that is returned I call GetRibbonGroup on the control and then call the Remove method on the controls collection. I get the count of the ribbon group (if one was returned) and if the count is zero, I remove the group from the ribbon.
 
All of the above works. However, when I am done, the popup that got added to the QAT when I added the group still appears on the QAT. If I click the popup, I crash because

CXTPRibbonGroupControlPopup::OnSetPopup

is called and it does this:

m_pCommandBar = new CXTPRibbonGroupPopupToolBar(m_pPopupGroup);

However, m_pPopupGroup has been deleted (all instance data is 0xfeeefeee).
 
I have found that the group gets deleted when I do this:
 
Tab = Ribbon->FindTab ( id of the tab that contains the group )
Group = Tab->FindGroup( id of the group )
index = Group->GetIndex()
Groups = Tab->GetGroups()
Groups->Remove( index )
 
At that point, the group destructor is called. But the group appears to be copied in that group control popup. Hence the crash if the user clicks the popup.
 
Note that if I add a control from the group to the QAT and unload the add-in, when I call the controls remove method, the control is also automatically removed from the QAT too.
 
So Oleg,
 
What is the correct way to remove a control and the group that contained a control since the group could have been added to the QAT?
 
Oleg, A bit more info. I see the CXTPRibbonGroupControlPopup being checked to see if it is on the QAT. It is not but the QAT has another object of that class that contains the same group pointer. Not sure how or why there are two of those objects containing the same group pointer.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.