Changeset 11cb98


Ignore:
Timestamp:
May 29, 2010, 1:11:22 PM (15 years ago)
Author:
Frederik Heber <heber@…>
Children:
25a549
Parents:
aa36cc
Message:

Fixes to prevent seg'faults.

  • CommandLineWindow::~CommandLineWindow() - does not unregister and delete all actions as this is done by the ActionRegistry anyway
  • main() - use atexit(cleanUp) (by Till) to ensure correct order of the cleanup
  • performCriticalExit() - don't free still allocated memory as this is handled by any good operation system nowadays
Location:
molecuilder/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/UIElements/CommandLineUI/CommandLineWindow.cpp

    raa36cc r11cb98  
    7373CommandLineWindow::~CommandLineWindow()
    7474{
    75   // go through all possible actions
    76   for(std::map<const std::string,Action*>::iterator ActionRunner = ActionRegistry::getInstance().getBeginIter(); ActionRegistry::getInstance().getBeginIter() != ActionRegistry::getInstance().getEndIter(); ActionRunner = ActionRegistry::getInstance().getBeginIter()) {
    77     ActionRegistry::getInstance().unregisterAction(ActionRunner->second);
    78     delete(ActionRunner->second);
    79   }
     75//  // go through all possible actions
     76//  for(std::map<const std::string,Action*>::iterator ActionRunner = ActionRegistry::getInstance().getBeginIter(); ActionRegistry::getInstance().getBeginIter() != ActionRegistry::getInstance().getEndIter(); ActionRunner = ActionRegistry::getInstance().getBeginIter()) {
     77//    ActionRegistry::getInstance().unregisterAction(ActionRunner->second);
     78//    delete(ActionRunner->second);
     79//  }
    8080
    8181  delete statusIndicator;
  • molecuilder/src/builder.cpp

    raa36cc r11cb98  
    5353
    5454#include <cstring>
     55#include <cstdlib>
    5556
    5657#include "analysis_bonds.hpp"
     
    25172518    ActionHistory::init();
    25182519
     2520    // from this moment on, we need to be sure to deeinitialize in the correct order
     2521    // this is handled by the cleanup function
     2522    atexit(cleanUp);
     2523
    25192524    // Parse command line options and if present create respective UI
    25202525    {
  • molecuilder/src/helpers.cpp

    raa36cc r11cb98  
    209209 */
    210210void performCriticalExit() {
    211   map<void*, size_t> pointers = MemoryUsageObserver::getInstance()->getPointersToAllocatedMemory();
    212   for (map<void*, size_t>::iterator runner = pointers.begin(); runner != pointers.end(); runner++) {
    213     Free(((void**) &runner->first));
    214   }
     211//  map<void*, size_t> pointers = MemoryUsageObserver::getInstance()->getPointersToAllocatedMemory();
     212//  for (map<void*, size_t>::iterator runner = pointers.begin(); runner != pointers.end(); runner++) {
     213//    Free(((void**) &runner->first));
     214//  }
    215215
    216216  exit(255);
Note: See TracChangeset for help on using the changeset viewer.