ociobase: detect removal from parent too
Fixes crash when copying and pasting an OCIOBase node
This commit is contained in:
@@ -35,18 +35,14 @@ OCIOBaseNode::OCIOBaseNode() :
|
||||
|
||||
SetEffectInput(kTextureInput);
|
||||
|
||||
connect(this, &Node::AddedToGraph, this, &OCIOBaseNode::ParentChanged);
|
||||
connect(this, &Node::AddedToGraph, this, &OCIOBaseNode::AddedToGraph);
|
||||
connect(this, &Node::RemovedFromGraph, this, &OCIOBaseNode::RemovedFromGraph);
|
||||
|
||||
SetFlags(kVideoEffect);
|
||||
}
|
||||
|
||||
void OCIOBaseNode::ParentChanged(NodeGraph *graph)
|
||||
void OCIOBaseNode::AddedToGraph(NodeGraph *graph)
|
||||
{
|
||||
if (manager_) {
|
||||
disconnect(manager_, &ColorManager::ConfigChanged, this, &OCIOBaseNode::ConfigChanged);
|
||||
manager_ = nullptr;
|
||||
}
|
||||
|
||||
if (Project *p = dynamic_cast<Project*>(graph)) {
|
||||
manager_ = p->color_manager();
|
||||
connect(manager_, &ColorManager::ConfigChanged, this, &OCIOBaseNode::ConfigChanged);
|
||||
@@ -54,6 +50,14 @@ void OCIOBaseNode::ParentChanged(NodeGraph *graph)
|
||||
}
|
||||
}
|
||||
|
||||
void OCIOBaseNode::RemovedFromGraph()
|
||||
{
|
||||
if (manager_) {
|
||||
disconnect(manager_, &ColorManager::ConfigChanged, this, &OCIOBaseNode::ConfigChanged);
|
||||
manager_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void OCIOBaseNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
|
||||
{
|
||||
if (value[kTextureInput].toTexture() && processor_) {
|
||||
|
||||
@@ -51,7 +51,9 @@ private:
|
||||
ColorProcessorPtr processor_;
|
||||
|
||||
private slots:
|
||||
void ParentChanged(olive::NodeGraph *graph);
|
||||
void AddedToGraph(NodeGraph *graph);
|
||||
|
||||
void RemovedFromGraph();
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user