Changeset 21218
- Timestamp:
- 07/04/08 15:39:24 (3 months ago)
- Location:
- v6/smop
- Files:
-
- 2 modified
-
src/p6opaque.sm0p (modified) (1 diff)
-
test/12_p6opaque.sm0p (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
v6/smop/src/p6opaque.sm0p
r21216 r21218 203 203 ((SMOP__p6opaque_struct*)invocant)->metadata = NULL; 204 204 smop_lowlevel_unlock(invocant); 205 SMOP_RELEASE(interpreter,m->how); 206 free(m); 205 if (m) { 206 if (m->how) SMOP_RELEASE(interpreter,m->how); 207 free(m); 208 } 207 209 } 208 210 -
v6/smop/test/12_p6opaque.sm0p
r21216 r21218 11 11 SMOP__Object* capture) { 12 12 if (identifier == SMOP__ID__dispatch) { 13 printf("ok 3 - called dispatch\n"); 13 SMOP__Object* called = SMOP__NATIVE__capture_positional(interpreter,capture,1); 14 if (called == SMOP__ID__STORE) { 15 printf("ok 3 - called dispatch\n"); 16 } else if (called == SMOP__ID__DESTROYALL) { 17 printf("ok 4 - called DESTROYALL on the metaclass\n"); 18 } else { 19 printf("not ok - unkown method to dispatch\n"); 20 } 21 SMOP_RELEASE(interpreter, called); 14 22 SMOP_RELEASE(interpreter, capture); 15 23 } else if (identifier == SMOP__ID__DESTROYALL) { … … 25 33 SMOP__ResponderInterface* responder, 26 34 SMOP__Object* obj) { 27 printf("-");28 35 smop_lowlevel_refcnt_dec(interpreter, responder, obj); 29 36 return obj; … … 33 40 SMOP__ResponderInterface* responder, 34 41 SMOP__Object* obj) { 35 printf("+");36 42 smop_lowlevel_refcnt_inc(interpreter, responder, obj); 37 43 return obj; … … 41 47 smop_init(); 42 48 43 printf("1.. 6\n");49 printf("1..7\n"); 44 50 45 51 … … 64 70 $p6opaque.SMOP__ID__REPR_how($how); 65 71 $p6opaque.SMOP__ID__STORE(); 72 SMOP__SLIME__CurrentFrame.forget(); 66 73 }; 67 74 … … 75 82 printf("ok 2 - goto frame.\n"); 76 83 84 printf("# before freeing how\n"); 85 SMOP_RELEASE(interpreter,how); 86 87 printf("# before freeing p6opaque\n"); 88 SMOP_RELEASE(interpreter,p6opaque); 89 77 90 SMOP_DISPATCH(interpreter, SMOP_RI(interpreter), 78 91 SMOP__ID__loop, SMOP__NATIVE__capture_create(interpreter, … … 81 94 NULL, NULL)); 82 95 83 printf("ok 5- interpreter loop.\n");96 printf("ok 6 - interpreter loop.\n"); 84 97 85 SMOP_RELEASE(SMOP__INTPTR__InterpreterInstance,how); 86 SMOP_RELEASE(SMOP__INTPTR__InterpreterInstance,p6opaque); 98 printf("# before freeing the interpreter\n"); 87 99 SMOP_RELEASE(SMOP__INTPTR__InterpreterInstance,interpreter); 88 100 89 printf("ok 6- Scalar destroyed should free the p6opaque object also.\n");101 printf("ok 7 - Scalar destroyed should free the p6opaque object also.\n"); 90 102 91 103 smop_destr();
