Changeset 0249ce


Ignore:
Timestamp:
Sep 6, 2016, 2:36:17 PM (9 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, 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_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, GeometryObjects, Gui_displays_atomic_force_velocity, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, 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, Ubuntu_1604_changes, stable
Children:
3d61c7
Parents:
ed8a68
git-author:
Frederik Heber <heber@…> (08/30/16 12:36:22)
git-committer:
Frederik Heber <heber@…> (09/06/16 14:36:17)
Message:

FIX: Pop..Action need to check whether stack is actually non-empty.

  • this caused a segfault in python all-actions regression test.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/World.cpp

    red8a68 r0249ce  
    642642
    643643void World::popAtomSelection(){
    644   OBSERVE;
    645   NOTIFY(SelectionChanged);
    646   const atomIdsVector_t atomids = selectedAtoms_Stack.top();
    647   boost::function<void (const atomId_t)> IdSelector =
    648       boost::bind(static_cast<void (World::*)(const atomId_t)>(&World::selectAtom), this, _1);
    649   unselectVectorOfInstances<AtomSet>(selectedAtoms.begin(), selectedAtoms.end());
    650   selectedAtoms.clear();
    651   std::for_each(atomids.begin(),atomids.end(), IdSelector);
    652   selectedAtoms_Stack.pop();
     644  if (!selectedAtoms_Stack.empty()) {
     645    OBSERVE;
     646    NOTIFY(SelectionChanged);
     647    const atomIdsVector_t atomids = selectedAtoms_Stack.top();
     648    boost::function<void (const atomId_t)> IdSelector =
     649        boost::bind(static_cast<void (World::*)(const atomId_t)>(&World::selectAtom), this, _1);
     650    unselectVectorOfInstances<AtomSet>(selectedAtoms.begin(), selectedAtoms.end());
     651    selectedAtoms.clear();
     652    std::for_each(atomids.begin(),atomids.end(), IdSelector);
     653    selectedAtoms_Stack.pop();
     654  }
    653655}
    654656
     
    825827
    826828void World::popMoleculeSelection(){
    827   OBSERVE;
    828   NOTIFY(SelectionChanged);
    829   const moleculeIdsVector_t moleculeids = selectedMolecules_Stack.top();
    830   boost::function<void (const moleculeId_t)> IdSelector =
    831       boost::bind(static_cast<void (World::*)(const moleculeId_t)>(&World::selectMolecule), this, _1);
    832   unselectVectorOfInstances<MoleculeSet>(selectedMolecules.begin(), selectedMolecules.end());
    833   selectedMolecules.clear();
    834   std::for_each(moleculeids.begin(),moleculeids.end(), IdSelector);
    835   selectedMolecules_Stack.pop();
     829  if (!selectedMolecules_Stack.empty()) {
     830    OBSERVE;
     831    NOTIFY(SelectionChanged);
     832    const moleculeIdsVector_t moleculeids = selectedMolecules_Stack.top();
     833    boost::function<void (const moleculeId_t)> IdSelector =
     834        boost::bind(static_cast<void (World::*)(const moleculeId_t)>(&World::selectMolecule), this, _1);
     835    unselectVectorOfInstances<MoleculeSet>(selectedMolecules.begin(), selectedMolecules.end());
     836    selectedMolecules.clear();
     837    std::for_each(moleculeids.begin(),moleculeids.end(), IdSelector);
     838    selectedMolecules_Stack.pop();
     839  }
    836840}
    837841
Note: See TracChangeset for help on using the changeset viewer.