- Fix XMLSerializer to disable notifications to HistoryObservers

during the loading of a snapshot. This should fix a non-deterministic
sigsegv due to asyncronous callback mappings.


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@997 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-09-02 12:46:47 +00:00
parent 634499f6cf
commit 77c91ebfec
2 changed files with 7 additions and 35 deletions

View File

@ -69,6 +69,9 @@ void XMLSerializer::restore_snapshot(const Glib::ustring& filename, History& his
// TODO - all to do!! // TODO - all to do!!
// DEBUG - remove me when finished // DEBUG - remove me when finished
// disable notifications over history until the end of this method
hist.set_notify_enabled(false);
#ifdef LIBXML_SAX1_ENABLED #ifdef LIBXML_SAX1_ENABLED
xmlDocPtr doc; xmlDocPtr doc;
@ -85,7 +88,7 @@ void XMLSerializer::restore_snapshot(const Glib::ustring& filename, History& his
throw SerializerError("Parsing Error: doc is invalid."); throw SerializerError("Parsing Error: doc is invalid.");
} }
clear_history(hist); hist.clear();
XMLSerializerFactory fact(hist); XMLSerializerFactory fact(hist);
// read all elements and fill hist // read all elements and fill hist
@ -103,6 +106,9 @@ void XMLSerializer::restore_snapshot(const Glib::ustring& filename, History& his
*/ */
#error Compilation of LIBXML with SAX1 support must be enabled #error Compilation of LIBXML with SAX1 support must be enabled
#endif /* LIBXML_SAX1_ENABLED */ #endif /* LIBXML_SAX1_ENABLED */
// Re-enable notifications over history observers
hist.set_notify_enabled(true);
} }
@ -195,33 +201,6 @@ void XMLSerializer::fill_schedulables(xmlNodePtr schedulables_node, const Histor
} }
*/ */
void XMLSerializer::clear_history(History& hist)
{
const Environment& env = hist.get_last_environment();
const Environment::Processes& pvect = env.get_processes();
typedef std::vector<Process*>::const_iterator proc_iterator;
proc_iterator iter = pvect.begin();
while (iter != pvect.end())
{
hist.remove(*(*iter));
iter = pvect.begin();
}
const Environment::Resources& rvect = env.get_resources();
typedef Environment::Resources::const_iterator res_iterator;
res_iterator riter = rvect.begin();
while (riter != rvect.end())
{
hist.remove((*riter).first);
riter = rvect.begin();
}
}
void XMLSerializer::read_doc(xmlDocPtr doc, XMLSerializerFactory& fact) throw(SerializerError) void XMLSerializer::read_doc(xmlDocPtr doc, XMLSerializerFactory& fact) throw(SerializerError)
{ {
/* /*

View File

@ -110,13 +110,6 @@ namespace sgpem
*/ */
// void fill_schedulables(xmlNodePtr schedulables_node, const History& hist); // void fill_schedulables(xmlNodePtr schedulables_node, const History& hist);
/**
\brief Clear the passed history
For each process in history deletes it.
For each resource in history deletes it.
*/
void clear_history(History& hist);
/** /**
\brief Restore the snapshot from the passed xml document \brief Restore the snapshot from the passed xml document