mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-05 23:40:02 +01:00
BugFix Rename source when replaced
Renaming of source when replacing a source should be done after deletion of the previous one for the name to be available
This commit is contained in:
@@ -182,8 +182,14 @@ void Mixer::update()
|
|||||||
insertSource(candidate_sources_.front().first, candidate_sources_.size() > 1 ? View::INVALID : View::MIXING);
|
insertSource(candidate_sources_.front().first, candidate_sources_.size() > 1 ? View::INVALID : View::MIXING);
|
||||||
|
|
||||||
// the second element of the pair is the source to be replaced, i.e. deleted if provided
|
// the second element of the pair is the source to be replaced, i.e. deleted if provided
|
||||||
if (candidate_sources_.front().second != nullptr)
|
if (candidate_sources_.front().second != nullptr) {
|
||||||
|
// keep previous name
|
||||||
|
std::string previous_name = candidate_sources_.front().second->name();
|
||||||
|
// delete previous
|
||||||
deleteSource(candidate_sources_.front().second);
|
deleteSource(candidate_sources_.front().second);
|
||||||
|
// rename new source with previous name
|
||||||
|
candidate_sources_.front().first->setName(previous_name);
|
||||||
|
}
|
||||||
|
|
||||||
candidate_sources_.pop_front();
|
candidate_sources_.pop_front();
|
||||||
}
|
}
|
||||||
@@ -589,9 +595,6 @@ void Mixer::replaceSource(Source *previous, Source *s)
|
|||||||
s->setImageProcessingEnabled( previous->imageProcessingEnabled() );
|
s->setImageProcessingEnabled( previous->imageProcessingEnabled() );
|
||||||
s->blendingShader()->blending = previous->blendingShader()->blending;
|
s->blendingShader()->blending = previous->blendingShader()->blending;
|
||||||
|
|
||||||
// rename s
|
|
||||||
renameSource(s, previous_name);
|
|
||||||
|
|
||||||
// add source 's' and remove source 'previous'
|
// add source 's' and remove source 'previous'
|
||||||
candidate_sources_.push_back( std::make_pair(s, previous) );
|
candidate_sources_.push_back( std::make_pair(s, previous) );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user