Skip to content

Commit d8bed7d

Browse files
committed
Fix life time of FFI CData and FFI CType with FFI\CDef
For GH-8556 the return type is stored in the CDef and doesn't outlive the CData. In that case it happened because temporaries were used, but it's also possible to get this with compiled variables when the variable holding the CDef leaves the scope. For GH-12910 the exception trace is built after the compiled variables are destroyed, so that means the FFI CDef instance got destroyed but the CData argument still remained. When the trace building code tries to get the class string for the exception, the CData instance tries to access the already-freed CDef. Fix all of this by storing a reference to the CDef object inside of CData and CType. Closes GH-8556. Closes GH-12910.
1 parent 1b5a159 commit d8bed7d

File tree

6 files changed

+342
-48
lines changed

6 files changed

+342
-48
lines changed

0 commit comments

Comments
 (0)