CAProvider: Fix cleanup during provider destruction
CAChannel's channelProvider pointers have all expired by now, so the destructor must empty caChannelList itself.
This commit is contained in:
@ -32,8 +32,11 @@ CAChannelProvider::CAChannelProvider(const std::tr1::shared_ptr<Configuration> &
|
||||
CAChannelProvider::~CAChannelProvider()
|
||||
{
|
||||
epicsGuard<epicsMutex> G(channelListMutex);
|
||||
while (CAChannel *ch = caChannelList.first()) {
|
||||
ch->disconnectChannel(); // Removes itself from the list
|
||||
while (CAChannel *ch = caChannelList.get()) {
|
||||
// Here disconnectChannel() can't call our delChannel()
|
||||
// beacuse its CAChannelProviderPtr has by now expired.
|
||||
// That's why we removed it from caChannelList above.
|
||||
ch->disconnectChannel();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user