class(TInterfacedObject, ITestListener) crashes with SIGSEGV
Original Reporter info from Mantis: dezlov
-
Reporter name: Denis Kozlov
Original Reporter info from Mantis: dezlov
- Reporter name: Denis Kozlov
Description:
Application crashes with SIGSEGV (Access violation) when running tests with custom test listener class declared as:
type TTestListener = class(TInterfacedObject, ITestListener)
However, everything works fine if declaration is changed to:
type TTestListener = class(TInterfacedPersistent, ITestListener)
Example project attached.
Use {$define PersistentTestListener} to switch between use of TInterfacedPersistent or TInterfacedObject for ITestListener.
Call stack at the time of a crash:
#0 ?? at :0
#1 SYSTEM_TINTERFACEDOBJECT_$___RELEASE$$LONGINT at :0
#2 fpc_intf_decr_ref at :0
#3 FPCUNIT_TTESTRESULT_$__STARTTESTSUITE$TTESTSUITE at :0
#4 FPCUNIT_TTESTSUITE_$__RUN$TTESTRESULT at :0
#5 ?? at :0
#6 SYSTEM_EXE_ENTRY$TENTRYINFORMATION at :0
This seems to suggest that a decrease of interface reference and forced object release occurs in fpcunit.TTestResult.StartTestSuite().
Tested with both:
FPC 2.6.4 i386-win32-win32/win64
FPC 3.1.1-r20:31301 [2015/08/09] for i386
Mantis conversion info:
- Mantis ID: 28504
- Platform: Windows
- Version: 3.1.1
- Monitored by: » Adriaan van Os (Adriaan van Os), » dezlov (Denis Kozlov)