| 444 | } |
| 445 | |
| 446 | void |
| 447 | ReadNodePrivate::destroyReadNode() |
| 448 | { |
| 449 | assert( QThread::currentThread() == qApp->thread() ); |
| 450 | if (!embeddedPlugin) { |
| 451 | return; |
| 452 | } |
| 453 | KnobsVec knobs = _publicInterface->getKnobs(); |
| 454 | |
| 455 | genericKnobsSerialization.clear(); |
| 456 | |
| 457 | std::string serializationString; |
| 458 | try { |
| 459 | std::ostringstream ss; |
| 460 | boost::archive::xml_oarchive oArchive(ss); |
| 461 | std::list<boost::shared_ptr<KnobSerialization> > serialized; |
| 462 | |
| 463 | |
| 464 | for (KnobsVec::iterator it = knobs.begin(); it != knobs.end(); ++it) { |
| 465 | |
| 466 | // The internal node still holds a shared ptr to the knob. |
| 467 | // Since we want to keep some knobs around, ensure they do not get deleted in the desctructor of the embedded node |
| 468 | embeddedPlugin->getEffectInstance()->removeKnobFromList(it->get()); |
| 469 | |
| 470 | if ( !(*it)->isDeclaredByPlugin() ) { |
| 471 | continue; |
| 472 | } |
| 473 | |
| 474 | //If it is a knob of this ReadNode, do not destroy it |
| 475 | bool isReadNodeKnob = false; |
| 476 | for (std::list<boost::weak_ptr<KnobI> >::iterator it2 = readNodeKnobs.begin(); it2 != readNodeKnobs.end(); ++it2) { |
| 477 | if (it2->lock() == *it) { |
| 478 | isReadNodeKnob = true; |
| 479 | break; |
| 480 | } |
| 481 | } |
| 482 | if (isReadNodeKnob) { |
| 483 | continue; |
| 484 | } |
| 485 | |
| 486 | //Keep pages around they will be re-used |
| 487 | KnobPage* isPage = dynamic_cast<KnobPage*>( it->get() ); |
| 488 | if (isPage) { |
| 489 | continue; |
| 490 | } |
| 491 | |
| 492 | //This is a knob of the Reader plug-in |
| 493 | |
| 494 | //Serialize generic knobs and keep them around until we create a new Reader plug-in |
| 495 | bool mustSerializeKnob; |
| 496 | bool isGeneric = isGenericKnob( (*it)->getName(), &mustSerializeKnob ); |
| 497 | if (!isGeneric || mustSerializeKnob) { |
| 498 | |
| 499 | /* if (!isGeneric && !(*it)->getDefaultIsSecret()) { |
| 500 | // Don't save the secret state otherwise some knobs could be invisible when cloning the serialization even if we change format |
| 501 | (*it)->setSecret(false); |
| 502 | }*/ |
| 503 |
nothing calls this directly
no test coverage detected