| 443 | } |
| 444 | |
| 445 | void |
| 446 | ReadNodePrivate::destroyReadNode() |
| 447 | { |
| 448 | assert( QThread::currentThread() == qApp->thread() ); |
| 449 | if (!embeddedPlugin) { |
| 450 | return; |
| 451 | } |
| 452 | KnobsVec knobs = _publicInterface->getKnobs(); |
| 453 | |
| 454 | genericKnobsSerialization.clear(); |
| 455 | |
| 456 | std::string serializationString; |
| 457 | try { |
| 458 | std::ostringstream ss; |
| 459 | { // see http://boost.2283326.n4.nabble.com/the-boost-xml-serialization-to-a-stringstream-does-not-have-an-end-tag-td2580772.html |
| 460 | // xml_oarchive must be destroyed before obtaining ss.str(), or the </boost_serialization> tag is missing, |
| 461 | // which throws an exception in boost 1.66.0, due to the following change: |
| 462 | // https://fossies.org/diffs/boost/1_65_1_vs_1_66_0/libs/serialization/src/basic_xml_grammar.ipp-diff.html |
| 463 | // see also https://svn.boost.org/trac10/ticket/13400 |
| 464 | // see also https://svn.boost.org/trac10/ticket/13354 |
| 465 | |
| 466 | boost::archive::xml_oarchive oArchive(ss); |
| 467 | std::list<KnobSerializationPtr> serialized; |
| 468 | |
| 469 | |
| 470 | for (KnobsVec::iterator it = knobs.begin(); it != knobs.end(); ++it) { |
| 471 | |
| 472 | // The internal node still holds a shared ptr to the knob. |
| 473 | // Since we want to keep some knobs around, ensure they do not get deleted in the destructor of the embedded node |
| 474 | embeddedPlugin->getEffectInstance()->removeKnobFromList(it->get()); |
| 475 | |
| 476 | if ( !(*it)->isDeclaredByPlugin() ) { |
| 477 | continue; |
| 478 | } |
| 479 | |
| 480 | //If it is a knob of this ReadNode, do not destroy it |
| 481 | bool isReadNodeKnob = false; |
| 482 | for (std::list<KnobIWPtr>::iterator it2 = readNodeKnobs.begin(); it2 != readNodeKnobs.end(); ++it2) { |
| 483 | if (it2->lock() == *it) { |
| 484 | isReadNodeKnob = true; |
| 485 | break; |
| 486 | } |
| 487 | } |
| 488 | if (isReadNodeKnob) { |
| 489 | continue; |
| 490 | } |
| 491 | |
| 492 | //Keep pages around they will be re-used |
| 493 | KnobPage* isPage = dynamic_cast<KnobPage*>( it->get() ); |
| 494 | if (isPage) { |
| 495 | continue; |
| 496 | } |
| 497 | |
| 498 | //This is a knob of the Reader plug-in |
| 499 | |
| 500 | //Serialize generic knobs and keep them around until we create a new Reader plug-in |
| 501 | bool mustSerializeKnob; |
| 502 | bool isGeneric = isGenericKnob( (*it)->getName(), &mustSerializeKnob ); |
nothing calls this directly
no test coverage detected