equal
deleted
inserted
replaced
634 */ |
634 */ |
635 template <typename Tcls> |
635 template <typename Tcls> |
636 static SQInteger DefSQDestructorCallback(SQUserPointer p, SQInteger size) |
636 static SQInteger DefSQDestructorCallback(SQUserPointer p, SQInteger size) |
637 { |
637 { |
638 /* Remove the real instance too */ |
638 /* Remove the real instance too */ |
639 if (p != NULL) delete (Tcls *)p; |
639 if (p != NULL) ((Tcls *)p)->Release(); |
640 return 0; |
640 return 0; |
641 } |
641 } |
642 |
642 |
643 /** |
643 /** |
644 * A general template to handle creating of instance with any amount of |
644 * A general template to handle creating of instance with any amount of |
650 { |
650 { |
651 /* Create the real instance */ |
651 /* Create the real instance */ |
652 Tcls *instance = HelperT<Tmethod>::SQConstruct((Tcls *)NULL, (Tmethod)NULL, vm); |
652 Tcls *instance = HelperT<Tmethod>::SQConstruct((Tcls *)NULL, (Tmethod)NULL, vm); |
653 sq_setinstanceup(vm, -Tnparam, instance); |
653 sq_setinstanceup(vm, -Tnparam, instance); |
654 sq_setreleasehook(vm, -Tnparam, DefSQDestructorCallback<Tcls>); |
654 sq_setreleasehook(vm, -Tnparam, DefSQDestructorCallback<Tcls>); |
|
655 instance->AddRef(); |
655 return 0; |
656 return 0; |
656 } |
657 } |
657 |
658 |
658 }; // namespace SQConvert |
659 }; // namespace SQConvert |
659 |
660 |