Changeset 589112 for src/UIElements


Ignore:
Timestamp:
Dec 5, 2010, 12:18:31 AM (14 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
6e06bd
Parents:
5d4b73 (diff), a01144 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'FixingMemDebugChunks' into stable

Location:
src/UIElements
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/CommandLineUI/CommandLineParser_validate.cpp

    r5d4b73 r589112  
    1919
    2020#include "Helpers/MemDebug.hpp"
     21
     22#include <boost/version.hpp>
    2123
    2224#include <iostream>
     
    4143  if (values.size() != 1) {
    4244    std::cerr <<  "Not one vector but " << values.size() << " given " << std::endl;
     45#if BOOST_VERSION < 104200
    4346    throw boost::program_options::validation_error("Unequal to one vector given");
     47#else
     48    throw boost::program_options::validation_error(
     49        boost::program_options::validation_error::invalid_option_value,
     50        std::string("value"),
     51        std::string("VectorValue")
     52    );
     53#endif
    4454  }
    4555  std::string argument(values.at(0));
     
    5969  if (components.size() != 3) {
    6070    std::cerr <<  "Specified vector does not have three components but " << components.size() << std::endl;
     71#if BOOST_VERSION < 104200
    6172    throw boost::program_options::validation_error("Specified vector does not have three components");
     73#else
     74    throw boost::program_options::validation_error(
     75        boost::program_options::validation_error::invalid_option_value,
     76        std::string("value"),
     77        std::string("VectorValue")
     78    );
     79#endif
    6280  }
    6381  VV.x = boost::lexical_cast<double>(components.at(0));
     
    7593  if (values.size() != 1) {
    7694    std::cerr <<  "Not one vector but " << values.size() << " given " << std::endl;
     95#if BOOST_VERSION < 104200
    7796    throw boost::program_options::validation_error("Unequal to one vector given");
     97#else
     98    throw boost::program_options::validation_error(
     99        boost::program_options::validation_error::invalid_option_value,
     100        std::string("value"),
     101        std::string("BoxValue")
     102    );
     103#endif
    78104  }
    79105  std::string argument(values.at(0));
     
    93119  if (components.size() != 6) {
    94120    std::cerr <<  "Specified vector does not have three components but " << components.size() << std::endl;
     121#if BOOST_VERSION < 104200
    95122    throw boost::program_options::validation_error("Specified symmetric box matrix does not have six components");
     123#else
     124    throw boost::program_options::validation_error(
     125        boost::program_options::validation_error::invalid_option_value,
     126        std::string("value"),
     127        std::string("BoxValue")
     128    );
     129#endif
    96130  }
    97131  BV.xx = boost::lexical_cast<double>(components.at(0));
     
    120154  if (values.size() != 1) {
    121155    std::cerr <<  "Not one file but " << values.size() << " given " << std::endl;
     156#if BOOST_VERSION < 104200
    122157    throw boost::program_options::validation_error("Unequal to one file given");
     158#else
     159    if (values.size() == 0) {
     160      throw boost::program_options::validation_error(
     161          boost::program_options::validation_error::at_least_one_value_required,
     162          std::string("value"),
     163          std::string("boost::filesystem::path")
     164      );
     165    } else {
     166      throw boost::program_options::validation_error(
     167          boost::program_options::validation_error::multiple_values_not_allowed,
     168          std::string("value"),
     169          std::string("boost::filesystem::path")
     170      );
     171    }
     172#endif
    123173  }
    124174  filename = values.at(0);
  • src/UIElements/Makefile.am

    r5d4b73 r589112  
    55AM_LDFLAGS = -ldl
    66AM_CXXFLAGS = ${QT_CXXFLAGS} ${GLU_CXXFLAGS}
    7 
     7AM_CPPFLAGS = ${BOOST_CPPFLAGS}
     8 
    89VIEWSOURCE = \
    910  Views/View.cpp \
     
    227228QTUI_DEFS =
    228229
     230GUI_LIBS =
    229231
    230232
     
    233235libMolecuilderUI_includedir = $(includedir)/molecuilder-$(MOLECUILDER_API_VERSION)/Actions/
    234236libMolecuilderQtUI_includedir = $(includedir)/molecuilder-$(MOLECUILDER_API_VERSION)/Actions/
    235 libMolecuilderUI_LIBS = \
     237libMolecuilderUI_@MOLECUILDER_API_VERSION@_la_LIBS = \
    236238        Actions/libMolecuilderActions-@MOLECUILDER_API_VERSION@.la
    237 libMolecuilderQtUI_LIBS = \
     239libMolecuilderQtUI_@MOLECUILDER_API_VERSION@_la_LIBS = \
    238240        Actions/libMolecuilderActions-@MOLECUILDER_API_VERSION@.la
     241
     242libMolecuilderQtUI_@MOLECUILDER_API_VERSION@_la_LIBADD = ${QT_LIB_GUI} -lQtOpenGL ${GLU_LIBS} ${QT_LDADD}
    239243
    240244nobase_libMolecuilderUI_include_HEADERS = ${UIHEADER}
     
    302306
    303307       
    304 MOSTLYCLEANFILES = unity.cpp
     308MOSTLYCLEANFILES = unity.cpp allmocs.moc.cpp
  • src/UIElements/Menu/Menu.cpp

    r5d4b73 r589112  
    4141 */
    4242Menu::~Menu()
    43 {}
     43{
     44  DuplicatesList.clear();
     45}
    4446
    4547/** Initialiser for class Menu.
     
    6567    CompleteFlag = true;
    6668    PossibleMissingFlag = false;
    67     for(MenuDescription::const_iterator iter = menudescriptions.getBeginIter();
    68         iter != menudescriptions.getEndIter();
     69    for(MenuDescription::const_iterator iter = MenuDescription::getInstance().getBeginIter();
     70        iter != MenuDescription::getInstance().getEndIter();
    6971        ++iter) {
    7072      // skip when already present
     
    137139  ASSERT (!isPresent(MenuName),
    138140      "Menu::addSubmenu() - trying to add menu "+MenuName+" with already present token!");
    139   addSubmenuItem(MenuName, menudescriptions.getDescription(MenuName));
     141  addSubmenuItem(MenuName, MenuDescription::getInstance().getDescription(MenuName));
    140142  DuplicatesList.insert(MenuName);
    141143  LastItem = MenuItem;
  • src/UIElements/Menu/Menu.hpp

    r5d4b73 r589112  
    7272
    7373  int TopPosition;  // current position to add
    74   MenuDescription menudescriptions; // contains the menu tree and description to each item
    7574  enum ItemType LastItem;  // check whether separator followed separator
    7675  std::set <std::string> DuplicatesList;  // is used to check for duplicates
  • src/UIElements/Menu/MenuDescription.cpp

    r5d4b73 r589112  
    1313 */
    1414
     15// include config.h
     16#ifdef HAVE_CONFIG_H
     17#include <config.h>
     18#endif
     19
     20#include "Helpers/MemDebug.hpp"
     21
    1522#include <iostream>
    1623#include <map>
    1724#include <string>
    1825
    19 #include "Actions/ActionRegistry.hpp"
     26//#include "Actions/ActionRegistry.hpp"
    2027#include "Menu/MenuDescription.hpp"
     28
     29#include "Patterns/Singleton_impl.hpp"
     30
     31MenuDescription::TextMap *MenuDescription::MenuDescriptionsMap = NULL;
     32MenuDescription::IterableMap *MenuDescription::MenuPositionMap = NULL;
     33MenuDescription::TextMap *MenuDescription::MenuNameMap = NULL;
     34
    2135
    2236/** Constructor of class MenuDescription.
     
    2539MenuDescription::MenuDescription()
    2640{
     41  // allocate maps
     42  MenuDescriptionsMap = new TextMap();
     43  MenuPositionMap = new IterableMap();
     44  MenuNameMap = new TextMap();
     45
    2746  // put each menu into its place, "" means top level
    28   MenuPositionMap["analysis"] = TopPosition("tools",1);
    29   MenuPositionMap["atom"] = TopPosition("edit",1);
    30   MenuPositionMap["command"] = TopPosition("",3);
    31   MenuPositionMap["edit"] = TopPosition("",2);
    32   MenuPositionMap["fragmentation"] = TopPosition("tools",3);
    33   MenuPositionMap["molecule"] = TopPosition("edit",2);
    34   MenuPositionMap["parser"] = TopPosition("edit",3);
    35   MenuPositionMap["selection"] = TopPosition("edit",4);
    36   MenuPositionMap["tesselation"] = TopPosition("tools",2);
    37   MenuPositionMap["tools"] = TopPosition("",4);
    38   MenuPositionMap["world"] = TopPosition("",1);
     47  MenuPositionMap->insert(std::make_pair("analysis",TopPosition("tools",1)));
     48  MenuPositionMap->insert(std::make_pair("atom",TopPosition("edit",1)));
     49  MenuPositionMap->insert(std::make_pair("command",TopPosition("",3)));
     50  MenuPositionMap->insert(std::make_pair("edit",TopPosition("",2)));
     51  MenuPositionMap->insert(std::make_pair("fragmentation",TopPosition("tools",3)));
     52  MenuPositionMap->insert(std::make_pair("molecule",TopPosition("edit",2)));
     53  MenuPositionMap->insert(std::make_pair("parser",TopPosition("edit",3)));
     54  MenuPositionMap->insert(std::make_pair("selection",TopPosition("edit",4)));
     55  MenuPositionMap->insert(std::make_pair("tesselation",TopPosition("tools",2)));
     56  MenuPositionMap->insert(std::make_pair("tools",TopPosition("",4)));
     57  MenuPositionMap->insert(std::make_pair("world",TopPosition("",1)));
    3958
    4059  // put menu description into each menu category
    41   MenuDescriptionsMap["analysis"] = "Analysis (pair correlation, volume)";
    42   MenuDescriptionsMap["atom"] = "Edit atoms";
    43   MenuDescriptionsMap["command"] = "Configuration";
    44   MenuDescriptionsMap["edit"] = "Edit";
    45   MenuDescriptionsMap["fragmentation"] = "Fragmentation";
    46   MenuDescriptionsMap["molecule"] = "Parse files into system";
    47   MenuDescriptionsMap["parser"] = "Edit molecules (load, parse, save)";
    48   MenuDescriptionsMap["selection"] = "Select atoms/molecules";
    49   MenuDescriptionsMap["tesselation"] = "Tesselate molecules";
    50   MenuDescriptionsMap["tools"] = "Various tools";
    51   MenuDescriptionsMap["world"] = "Edit world";
     60  MenuDescriptionsMap->insert(std::make_pair("analysis","Analysis (pair correlation, volume)"));
     61  MenuDescriptionsMap->insert(std::make_pair("atom","Edit atoms"));
     62  MenuDescriptionsMap->insert(std::make_pair("command","Configuration"));
     63  MenuDescriptionsMap->insert(std::make_pair("edit","Edit"));
     64  MenuDescriptionsMap->insert(std::make_pair("fragmentation","Fragmentation"));
     65  MenuDescriptionsMap->insert(std::make_pair("molecule","Parse files into system"));
     66  MenuDescriptionsMap->insert(std::make_pair("parser","Edit molecules (load, parse, save)"));
     67  MenuDescriptionsMap->insert(std::make_pair("selection","Select atoms/molecules"));
     68  MenuDescriptionsMap->insert(std::make_pair("tesselation","Tesselate molecules"));
     69  MenuDescriptionsMap->insert(std::make_pair("tools","Various tools"));
     70  MenuDescriptionsMap->insert(std::make_pair("world","Edit world"));
    5271
    5372  // put menu name into each menu category
    54   MenuNameMap["analysis"] = "Analysis";
    55   MenuNameMap["atom"] = "Atoms";
    56   MenuNameMap["command"] = "Configuration";
    57   MenuNameMap["edit"] = "Edit";
    58   MenuNameMap["fragmentation"] = "Fragmentation";
    59   MenuNameMap["molecule"] = "Molecules";
    60   MenuNameMap["parser"] = "Input/Output";
    61   MenuNameMap["selection"] = "Selection";
    62   MenuNameMap["tesselation"] = "Tesselation";
    63   MenuNameMap["tools"] = "Tools";
    64   MenuNameMap["world"] = "Globals";
     73  MenuNameMap->insert(std::make_pair("analysis","Analysis"));
     74  MenuNameMap->insert(std::make_pair("atom","Atoms"));
     75  MenuNameMap->insert(std::make_pair("command","Configuration"));
     76  MenuNameMap->insert(std::make_pair("edit","Edit"));
     77  MenuNameMap->insert(std::make_pair("fragmentation","Fragmentation"));
     78  MenuNameMap->insert(std::make_pair("molecule","Molecules"));
     79  MenuNameMap->insert(std::make_pair("parser","Input/Output"));
     80  MenuNameMap->insert(std::make_pair("selection","Selection"));
     81  MenuNameMap->insert(std::make_pair("tesselation","Tesselation"));
     82  MenuNameMap->insert(std::make_pair("tools","Tools"));
     83  MenuNameMap->insert(std::make_pair("world","Globals"));
    6584}
    6685
     
    6988 */
    7089MenuDescription::~MenuDescription()
    71 {}
     90{
     91  std::cout << "MenuDescription: clearing maps ... " << std::endl;
     92  for (IterableMap::iterator iter = MenuPositionMap->begin(); !MenuPositionMap->empty(); iter = MenuPositionMap->begin())
     93    MenuPositionMap->erase(iter);
     94  delete MenuNameMap;
     95  delete MenuDescriptionsMap;
     96  delete MenuPositionMap;
     97}
    7298
    7399/** Getter for MenuDescriptionsMap.
     
    77103const std::string MenuDescription::getDescription(const std::string &token) const
    78104{
    79   if (MenuDescriptionsMap.find(token) != MenuDescriptionsMap.end())
    80     return MenuDescriptionsMap.find(token)->second;
     105  if (MenuDescriptionsMap->find(token) != MenuDescriptionsMap->end())
     106    return MenuDescriptionsMap->find(token)->second;
    81107  else
    82108    return std::string();
    83109}
    84110
    85 /** Getter for MenuNameMap.
     111/** Getter for MenuNameMap->
    86112 * \param token name of menu
    87113 * \return description string of the menu or empty
     
    89115const std::string MenuDescription::getName(const std::string &token) const
    90116{
    91   if (MenuNameMap.find(token) != MenuNameMap.end())
    92     return MenuNameMap.find(token)->second;
     117  if (MenuNameMap->find(token) != MenuNameMap->end())
     118    return MenuNameMap->find(token)->second;
    93119  else
    94120    return std::string();
    95121}
    96122
    97 /** Constructs a multimap of all menus running over all actions belonging to it.
    98  * \return multimap with which actions belongs to which menu.
    99  */
    100 std::multimap <std::string, std::string> MenuDescription::getMenuItemsMap() const
    101 {
    102   std::multimap <std::string, std::string> result;
    103 
    104   ActionRegistry &AR = ActionRegistry::getInstance();
    105   for (ActionRegistry::const_iterator iter = AR.getBeginIter();iter != AR.getEndIter();++iter) {
    106     std::cout << "Inserting " << (iter->second)->getName() << " into menu " << (iter->second)->Traits.getMenuName() << std::endl;
    107     result.insert( std::pair<std::string, std::string> ((iter->second)->Traits.getMenuName(), (iter->second)->getName()));
    108   }
    109   // TODO: MenuPosition is not yet realized.
    110   return result;
    111 }
     123///** Constructs a multimap of all menus running over all actions belonging to it.
     124// * \return multimap with which actions belongs to which menu.
     125// */
     126//std::multimap <std::string, std::string> MenuDescription::getMenuItemsMap() const
     127//{
     128//  std::multimap <std::string, std::string> result;
     129//
     130//  ActionRegistry &AR = ActionRegistry::getInstance();
     131//  for (ActionRegistry::const_iterator iter = AR.getBeginIter();iter != AR.getEndIter();++iter) {
     132//    std::cout << "Inserting " << (iter->second)->getName() << " into menu " << (iter->second)->Traits.getMenuName() << std::endl;
     133//    result.insert( std::pair<std::string, std::string> ((iter->second)->Traits.getMenuName(), (iter->second)->getName()));
     134//  }
     135//  // TODO: MenuPosition is not yet realized.
     136//  return result;
     137//}
    112138
    113139/** Forward iterator from beginning of list of descriptions.
     
    116142MenuDescription::iterator MenuDescription::getBeginIter()
    117143{
    118   return MenuPositionMap.begin();
     144  return MenuPositionMap->begin();
    119145}
    120146
     
    124150MenuDescription::iterator MenuDescription::getEndIter()
    125151{
    126   return MenuPositionMap.end();
     152  return MenuPositionMap->end();
    127153}
    128154
     
    132158MenuDescription::const_iterator MenuDescription::getBeginIter() const
    133159{
    134   return MenuPositionMap.begin();
     160  return MenuPositionMap->begin();
    135161}
    136162
     
    140166MenuDescription::const_iterator MenuDescription::getEndIter() const
    141167{
    142   return MenuPositionMap.end();
     168  return MenuPositionMap->end();
    143169}
    144170
    145 
     171CONSTRUCT_SINGLETON(MenuDescription)
  • src/UIElements/Menu/MenuDescription.hpp

    r5d4b73 r589112  
    1313#include <string>
    1414
     15#include "Patterns/Singleton.hpp"
     16
    1517class MenuDescriptionTest;
    1618
     
    1820 *
    1921 */
    20 class MenuDescription
     22class MenuDescription : public Singleton<MenuDescription>
    2123{
    2224  friend class MenuDescriptionTest;
     25  friend class Singleton<MenuDescription>;
    2326public:
    24   MenuDescription();
    25   ~MenuDescription();
    2627
    27   typedef std::pair<std::string, int> TopPosition;
    28   typedef std::map<std::string, TopPosition> IterableMap;
     28  typedef std::pair<std::string const, int const> TopPosition;
     29  typedef std::map<std::string const, TopPosition const> IterableMap;
    2930  typedef IterableMap::iterator iterator;
    3031  typedef IterableMap::const_iterator const_iterator ;
    31   typedef std::map<std::string, std::string> TextMap;
     32  typedef std::map<std::string const, std::string const> TextMap;
    3233
    3334  // getter for description
     
    3536  const std::string getName(const std::string &token) const;
    3637
    37   std::multimap <std::string, std::string> getMenuItemsMap() const;
     38  //std::multimap <std::string, std::string> getMenuItemsMap() const;
    3839
    3940  // iterators
     
    4445
    4546private:
    46   TextMap MenuDescriptionsMap;
    47   IterableMap MenuPositionMap;
    48   TextMap MenuNameMap;
    49   std::multimap <std::string, std::string> MenuItemMap;
     47  MenuDescription();
     48  ~MenuDescription();
     49
     50  static TextMap *MenuDescriptionsMap;
     51  static IterableMap *MenuPositionMap;
     52  static TextMap *MenuNameMap;
    5053};
    5154
  • src/UIElements/Menu/MenuInterface.cpp

    r5d4b73 r589112  
    1010#include <config.h>
    1111#endif
     12
     13#include "Helpers/MemDebug.hpp"
    1214
    1315#include "Menu/MenuInterface.hpp"
  • src/UIElements/Menu/TextMenu/ActionMenuItem.hpp

    r5d4b73 r589112  
    2323public:
    2424  ActionMenuItem(char,const std::string &,TxMenu* const,const std::string &);
    25   virtual ~ActionMenuItem();
     25  ~ActionMenuItem();
    2626
    2727  virtual void doTrigger();
  • src/UIElements/Menu/TextMenu/DisplayMenuItem.hpp

    r5d4b73 r589112  
    2828  DisplayMenuItem(TxMenu* const _menu, StringView *_view, const std::string &_title,
    2929                  char _spacer=STD_MENU_TITLE_SPACER, int _length=STD_MENU_LENGTH);
    30   virtual ~DisplayMenuItem();
     30  ~DisplayMenuItem();
    3131
    3232  virtual void doTrigger();
  • src/UIElements/Menu/TextMenu/SeparatorMenuItem.hpp

    r5d4b73 r589112  
    2525  SeparatorMenuItem(TxMenu* const );
    2626  SeparatorMenuItem(TxMenu* const ,char,int);
    27   virtual ~SeparatorMenuItem();
     27  ~SeparatorMenuItem();
    2828
    2929  virtual void doTrigger();
  • src/UIElements/Menu/TextMenu/SubMenuItem.hpp

    r5d4b73 r589112  
    1212public:
    1313  SubMenuItem(char _trigger,const std::string &_description,TxMenu* const _parent, TxMenu* const _instance);
    14   virtual ~SubMenuItem();
     14  ~SubMenuItem();
    1515
    1616  virtual void doTrigger();
  • src/UIElements/Menu/TextMenu/TextMenu.hpp

    r5d4b73 r589112  
    6060   *
    6161   */
    62   virtual ~TextMenu()
     62  ~TextMenu()
    6363  {
     64    ShortcutMap.clear();
    6465    if (deleteMenu)
    6566      delete MenuInstance;
     67    for (typename SubmenuList::iterator iter = Submenus.begin(); !Submenus.empty(); iter = Submenus.begin()) {
     68      delete(*iter);
     69      Submenus.erase(iter);
     70    }
    6671  }
    6772
     
    102107  MenuShortcutMap ShortcutMap;
    103108
     109  typedef std::list< TextMenu<T> *> SubmenuList;
     110  SubmenuList Submenus;
     111
    104112  /** Adds an ActionItem by simply creating a new one.
    105113   * \param &token token of Action (token in ActionRegistry)
     
    128136  {
    129137    TextMenu<TxMenu> *NewMenu = new TextMenu<TxMenu>(outputter, token);
     138    Submenus.push_back(NewMenu);
    130139    new SubMenuItem(getSuitableShortForm(description), description, MenuInstance, NewMenu->getMenuInstance());
    131140    NewMenu->reserveShortcut('q',"leave"+token);
  • src/UIElements/Menu/TextMenu/TxMenu.cpp

    r5d4b73 r589112  
    5252TxMenu::~TxMenu()
    5353{
    54   for(std::list<MenuItem*>::iterator it=items.begin(); it != items.end(); it++)
     54  for(std::list<MenuItem*>::iterator it=items.begin(); !items.empty(); it=items.begin()) {
    5555    delete (*it);
     56    items.erase(it);
     57  }
    5658}
    5759
  • src/UIElements/Menu/TextMenu/TxMenu.hpp

    r5d4b73 r589112  
    3939
    4040  TxMenu(std::ostream& _outputter, const std::string _title, char _spacer=STD_MENU_TITLE_SPACER,int _length=STD_MENU_LENGTH);
    41   virtual ~TxMenu();
     41  ~TxMenu();
    4242
    4343  void addItem(MenuItem*);
  • src/UIElements/TextUI/TextWindow.cpp

    r5d4b73 r589112  
    8686TextWindow::~TextWindow()
    8787{
    88   for (std::list<Action *>::iterator iter = returnFromActions.begin(); !returnFromActions.empty(); ++iter)
     88  for (std::list<Action *>::iterator iter = returnFromActions.begin();
     89      !returnFromActions.empty();
     90      iter = returnFromActions.begin()) {
    8991    delete (*iter);
    90   returnFromActions.clear();
     92    returnFromActions.erase(iter);
     93  }
    9194  delete moleculeView;
    9295  delete statusIndicator;
  • src/UIElements/UIFactory.cpp

    r5d4b73 r589112  
    3434
    3535UIFactory::~UIFactory()
    36 {}
     36{
     37  // clear out factories map to allow boost::shared_ptr to do their work (i.e. to release mem)
     38  // this is necessary as factories is a static object
     39  factories.clear();
     40}
    3741
    3842void UIFactory::makeUserInterface(std::string type) {
Note: See TracChangeset for help on using the changeset viewer.