]> git.vpit.fr Git - perl/modules/Variable-Magic.git/commitdiff
Share the vtables with threaded perls
authorVincent Pit <vince@profvince.com>
Wed, 26 Oct 2011 13:37:55 +0000 (15:37 +0200)
committerVincent Pit <vince@profvince.com>
Wed, 26 Oct 2011 13:58:53 +0000 (15:58 +0200)
When a magical variable is cloned into a new thread, the associated vtables
aren't cloned by mg_dup(), but simply shared. This means that if a wizard
is casted upon a variable in the main interpreter, then a thread is created,
then the wizard is destroyed, and then the cloned variant of the magical
variable is manipulated, perl can no longer access the vtable (it was freed
when the wizard was destroyed) and memory misreads happen.

To solve this, the only solution is to make the vtables associated with
wizards shared and reference-counted.


No differences found