mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Allow Sink.SetSource() to be given an empty source.
In Java, allow source to be null (pointers are not used in C++, so this isn't necessary).
This commit is contained in:
@@ -67,13 +67,16 @@ void SinkImpl::SetEnabled(bool enabled) {
|
||||
void SinkImpl::SetSource(std::shared_ptr<SourceImpl> source) {
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
if (m_source == source) return;
|
||||
if (m_source) {
|
||||
if (m_enabledCount > 0) m_source->DisableSink();
|
||||
m_source->RemoveSink();
|
||||
}
|
||||
m_source = source;
|
||||
m_source->AddSink();
|
||||
if (m_enabledCount > 0) m_source->EnableSink();
|
||||
if (m_source) {
|
||||
m_source->AddSink();
|
||||
if (m_enabledCount > 0) m_source->EnableSink();
|
||||
}
|
||||
}
|
||||
SetSourceImpl(source);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user