This example shows a problem with Win32::GUI::UnHook()
The UnHook call appears to be the cause of error messages:
Attempt to free unreferenced scalar: SV 0x1a5519c, Perl
interpreter: 0x15d40a4 at unhookBug.pl line 40.
Attempt to free unreferenced scalar:
(W internal) Perl went to decrement the reference count
scalar to see if it would go to 0, and discovered that
already gone to 0 earlier, and should have been freed,
fact, probably was freed. This could indicate that
SvREFCNT_dec() was called too many times, or that
SvREFCNT_inc() was called too few times, or that the SV
was mortalized when it shouldn't have been, or that memory
has been corrupted.
It is possible to turn off internal warnings (that are
default) by setting no warnings (internal);
I'm certainly no XS expert, but it looks like it's
possible to get
SvREFCNT_dec(*removedvalue) called twice in UnHook().
Is this the problem?
#Turning off internal warnings removes the messages
#no warnings qw(internal);
use Win32::GUI 1.0;
my $WM_MOUSEMOVE = 512;
my $mw = new Win32::GUI::Window (
-size => [200,200],
or die "Failed to add Hook";
or die "Failed to remove hook";