1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00

revert to previous version of ref/cxt because nothing I do removes the dyld error

This commit is contained in:
Charles Lowell 2009-12-07 09:44:18 +02:00
parent 0b4b40a241
commit 7b4735af81
3 changed files with 15 additions and 8 deletions

View file

@ -5,12 +5,8 @@
using namespace v8;
v8_cxt::v8_cxt() {
// v8_cxt::v8_cxt() {
handle = Context::New();
printf("Allocate Native V8 Context\n");
}
v8_cxt::v8_cxt() : v8_ref<Context>(Context::New()) {
printf("Allocate Native V8 Context\n");
}
VALUE v8_cxt_allocate(VALUE clazz) {

View file

@ -2,13 +2,16 @@
#include "stdio.h"
using namespace v8;
template <class T> v8_ref<T>::v8_ref(Handle<T> object) : handle(*object) {
printf("Allocated v8 reference\n");
}
template <class T> v8_ref<T>::~v8_ref() {
printf("Disposing of v8 reference\n");
handle.Dispose();
if (!handle.IsEmpty()) {
handle.Dispose();
}
}
void v8_ref_mark(v8_ref_data* ref) {

View file

@ -3,12 +3,20 @@
#include <v8.h>
//this is a non-template superclass so that the mark() and free() functions
//don't need to be templatized. Not sure if this is valid... are
// class destructors virtual?
class v8_ref_data {
};
//the v8_ref wraps a v8 handle so that ruby can hold a reference to it.
template <class T> class v8_ref : v8_ref_data {
public:
//takes a handle object and adds a new persistent handle for
//the referenced object.
v8_ref(v8::Handle<T> object);
~v8_ref();
private: