[T3D 1.1 Beta 1 Bug] Toolbar multiple events firing - RESOLVED
by Joseph W. · in Torque 3D Professional · 06/05/2010 (1:45 pm) · 4 replies
I have found a rather major bug and have not found anywhere it has been reported.
It as of now is easily reproducible through the GUI Editor, I have also had it happen within the Verve Editor as well (I am sure it is some change in toolbars potentially but have not had the time to investigate deeply)
Create a new project from the "Full" template. Play the new project and enter a level. Press F10 four or five times causing it to open and close. Now go to a GUI and try and Save As (since this will show you what is happening but through a debug you can see Open and Save both do it as well). You will get multiple Save Dialog windows for each time you pressed F10 (roughly). I am sure it is potentially effecting other functions on the toolbar by calling them multiple times as well.
It as of now is easily reproducible through the GUI Editor, I have also had it happen within the Verve Editor as well (I am sure it is some change in toolbars potentially but have not had the time to investigate deeply)
Create a new project from the "Full" template. Play the new project and enter a level. Press F10 four or five times causing it to open and close. Now go to a GUI and try and Save As (since this will show you what is happening but through a debug you can see Open and Save both do it as well). You will get multiple Save Dialog windows for each time you pressed F10 (roughly). I am sure it is potentially effecting other functions on the toolbar by calling them multiple times as well.
Associate Joseph W.
ADMCMA
So it appears that the PopupMenu is notifying Torque that it will be handling the select event for that menu item but never then removing that notification event.
When a PopupMenu gets attached to a menubar this line of code gets called inside /Engine/source/platform/menus/popupMenu.cpp
When that same PopupMenu gets removed from the menubar this line of code gets called in the same file:
Sim::postCurrentEvent(this, new PopUpNotifyRemoveEvent()); // PopUpNotifyRemoveEvent class is declared at the top of this same file /// Event class used to remove popup menus from the event notification in a safe way class PopUpNotifyRemoveEvent : public SimEvent { public: void process(SimObject *object) { PopupMenu::smPopupMenuEvent.remove((PopupMenu *)object, &PopupMenu::handleSelectEvent); } };This SimEvent processing event is NEVER getting called anytime I debug through. So what appears to be happening is that for whatever reason some PopupMenu items are not removing themselves from the events list and causing double calls to happen. What I can't quite figure out is why it is inconsistent.
What I do know is that if I replace the Sim::postMenuEvent with:
That it appears to "correct" the problem but I suspect that somewhere there is a memory leak.
Hopefully this can help someone to give me a better direction to a clean fix.
What I can't quite debug is why it is not a consistent bug. If I open and close the GuiEditor multiple times I do not always get an event for each time even though it is never calling the event to remove the notification.