epics-base / pvDataCPP

pvDataCPP is an EPICS V4 C++ module
https://epics-base.github.io/pvDataCPP/
Other
6 stars 16 forks source link

FieldCreate::Helper - pure virtual function call #70

Closed mdavidsaver closed 4 years ago

mdavidsaver commented 4 years ago

I've had two reports of a crash in the compare() call below in two different environments (gcc/Linux and msvc/win32).

https://github.com/epics-base/pvDataCPP/blob/17fa7a7724998f9153afe1bb0e820c64d9f7a7f1/src/factory/FieldCreateFactory.cpp#L60-L63

The WIN32 case specifically gives an error "pure virtual function call" which suggests to me that this isn't simply *NULL.

mdavidsaver commented 4 years ago

While I don't understand the crash well, I think my use of dynamic_cast here, on an object which may have started destruction, is suspect. This code is synchronized with ~Field(), and valgrind doesn't report a data race. However, it might be straight undefined behavior.

In any event, use of dynamic_cast is actually an "optimization" here, and can simply be omitted by dd24b2ad75847ea728553d9eba5002551c7b4525. We'll see if there are any further occurrences.

mdavidsaver commented 4 years ago

May be fixed as of 95d452870c8f79f6dcf790b6fee779bae798624d in Module 8.0.1 Base 7.0.3.1

mdavidsaver commented 4 years ago

Based on user feedback, probably fixed.