From: dbv Date: Tue, 28 Mar 2017 13:43:35 +0000 (+0300) Subject: Issue #1868: Crash with dump python when I translate a same object several times X-Git-Tag: V_2.7.0~164 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cac95b57f2423d30e627c77c916c1bd5f509112c;p=modules%2Fshaper.git Issue #1868: Crash with dump python when I translate a same object several times Dump will show error window if history line not at the end. --- diff --git a/src/ExchangePlugin/ExchangePlugin_Dump.cpp b/src/ExchangePlugin/ExchangePlugin_Dump.cpp index 5c5ee4665..d9effab93 100644 --- a/src/ExchangePlugin/ExchangePlugin_Dump.cpp +++ b/src/ExchangePlugin/ExchangePlugin_Dump.cpp @@ -50,6 +50,27 @@ void ExchangePlugin_Dump::dump(const std::string& theFileName) aDumper->clear(); DocumentPtr aDoc = ModelAPI_Session::get()->moduleDocument(); + int aFeaturesNb = aDoc->size(ModelAPI_Feature::group()); + if(aFeaturesNb > 1) { + FeaturePtr aLastFeature = + ModelAPI_Feature::feature(aDoc->object(ModelAPI_Feature::group(), aFeaturesNb - 1)); + if(aDoc->currentFeature(true) != aLastFeature) { + setError("Dump cannot be done. Please move the history line to the end before dumping."); + return; + } + } + + DocumentPtr anActiveDoc = ModelAPI_Session::get()->activeDocument(); + aFeaturesNb = anActiveDoc->size(ModelAPI_Feature::group()); + if(aFeaturesNb > 1) { + FeaturePtr aLastFeature = + ModelAPI_Feature::feature(anActiveDoc->object(ModelAPI_Feature::group(), aFeaturesNb - 1)); + if(anActiveDoc->currentFeature(true) != aLastFeature) { + setError("Dump cannot be done. Please move the history line to the end before dumping."); + return; + } + } + std::list aFeatures = aDoc->allFeatures(); for(std::list::const_iterator aFeatIt = aFeatures.begin(); aFeatIt != aFeatures.end();