Reference counting fails for result values
Original Reporter info from Mantis: hennymcc
-
Reporter name:
Original Reporter info from Mantis: hennymcc
- Reporter name:
Description:
When an interfaced object is passed as a result value of a method and the result is directly just for method invocation (e.g. Test.SomeMethod().SomeMethod()), the reference count might be zero and member data uninitialized.
Steps to reproduce:
Assume we have an interface ITest with a method SomeMethod().
Create an object of the interface, for example Test, and call Test.SomeMethod().SomeMethod().
The second call to SomeMethod() fails as the reference count was decreased to early.
See the attached example program.
Additional information:
The error occurs in fpc 2.2.2 (win) and fpc 2.2.4 (linux).
With delphi everything works fine.
Mantis conversion info:
- Mantis ID: 14019
- OS: All
- Platform: All
- Version: 2.2.2
- Fixed in version: 2.4.0
- Fixed in revision: 13310 (#c0e51f3e)