On Wed, Feb 09, 2000 at 10:09:14AM +0100, [EMAIL PROTECTED] wrote:
> two slight suggestions for group watchers. Accidentally I wrote:
>
> $groupWatcher->add(\$i);
>
> where $i was still unused (of course, in a hack without "use strict"). This causes a
>segmentation fault.
>
> Being on this way, I tried:
>
> $groupWatcher->add(\$groupWatcher);
>
> which produced the message:
>
> "Attempt to use destroyed object (RV=0x81634dc (null)=0x80f1b8c) at ..."
Thanks.
--
"Never ascribe to malice that which can be explained by stupidity."
via, but not speaking for Deutsche Bank
==== //depot/D/Event/c/typemap.c#26 - /cache/D/Event/c/typemap.c ====
--- /tmp/tmp.16986.0 Wed Feb 9 08:51:02 2000
+++ /cache/D/Event/c/typemap.c Wed Feb 9 08:47:22 2000
@@ -1,3 +1,5 @@
+#define MG_PRIVATE_CODE ((((unsigned)'e')<<8) + (unsigned)'v')
+
static SV *wrap_watcher(void *ptr, HV *stash, SV *temple) {
SV *ref;
MAGIC **mgp;
@@ -26,6 +28,7 @@
Zero(mg, 1, MAGIC);
mg->mg_type = '~';
mg->mg_obj = (SV*) ptr; /* NOT refcnt'd */
+ mg->mg_private = MG_PRIVATE_CODE;
*mgp = mg;
return ref;
@@ -50,8 +53,13 @@
if (!sv || !SvROK(sv))
croak("sv_2watcher: not a reference?");
sv = SvRV(sv);
+ if (SvTYPE(sv) < SVt_PVMG)
+ croak("sv_2watcher: not a watcher");
mg = mg_find(sv, '~');
if (mg) {
+ if (mg->mg_private != MG_PRIVATE_CODE) {
+ croak("Can't find event magic (SV=0x%x)", sv);
+ }
return (void*) mg->mg_obj;
}
croak("Attempt to use destroyed object (RV=0x%x %s=0x%x)",