index 1cc45f3c7ebf5388e55d32fe5ca83aed82b0a418..56984dcbb99095d85b1c65e4ecf0221bffe198ba 100644 (file)
void
Editor::addDocument (SPDocument *doc)
{
- g_assert (!g_slist_find (_instance->_documents, doc));
- _instance->_documents = g_slist_append (_instance->_documents, doc);
+ if ( _instance->_document_set.find(doc) == _instance->_document_set.end() ) {
+ _instance->_documents = g_slist_append (_instance->_documents, doc);
+ }
+ _instance->_document_set.insert(doc);
}
void
Editor::removeDocument (SPDocument *doc)
{
- g_assert (g_slist_find (_instance->_documents, doc));
- _instance->_documents = g_slist_remove (_instance->_documents, doc);
+ _instance->_document_set.erase(doc);
+ if ( _instance->_document_set.find(doc) == _instance->_document_set.end() ) {
+ _instance->_documents = g_slist_remove (_instance->_documents, doc);
+ }
}
SPDesktop*