From 334bfbad3fda3860f51b74cd6370786ef253ad49 Mon Sep 17 00:00:00 2001 From: pescuma Date: Tue, 20 Jan 2009 23:24:30 +0000 Subject: skins: templates are kept in memory git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@128 c086bb3d-8645-0410-b8da-73a8550f86e7 --- Plugins/skins/SkinLib/SkinOption_v8_wrapper.cpp | 48 +++++++++++++++++-------- 1 file changed, 33 insertions(+), 15 deletions(-) (limited to 'Plugins/skins/SkinLib/SkinOption_v8_wrapper.cpp') diff --git a/Plugins/skins/SkinLib/SkinOption_v8_wrapper.cpp b/Plugins/skins/SkinLib/SkinOption_v8_wrapper.cpp index 7f166c7..944bb6e 100644 --- a/Plugins/skins/SkinLib/SkinOption_v8_wrapper.cpp +++ b/Plugins/skins/SkinLib/SkinOption_v8_wrapper.cpp @@ -16,20 +16,24 @@ using namespace v8; static Handle Get_SkinOption_description(Local property, const AccessorInfo &info) { + HandleScope scope; + Local self = info.Holder(); Local wrap = Local::Cast(self->GetInternalField(0)); if (wrap.IsEmpty()) - return Undefined(); + return scope.Close( Undefined() ); SkinOption *tmp = (SkinOption *) wrap->Value(); if (tmp == NULL) - return Undefined(); + return scope.Close( Undefined() ); - return String::New((const V8_TCHAR *) tmp->getDescription()); + return scope.Close( String::New((const V8_TCHAR *) tmp->getDescription()) ); } static void Set_SkinOption_description(Local property, Local value, const AccessorInfo& info) { + HandleScope scope; + Local self = info.Holder(); Local wrap = Local::Cast(self->GetInternalField(0)); if (wrap.IsEmpty()) @@ -49,20 +53,24 @@ static void Set_SkinOption_description(Local property, Local valu static Handle Get_SkinOption_min(Local property, const AccessorInfo &info) { + HandleScope scope; + Local self = info.Holder(); Local wrap = Local::Cast(self->GetInternalField(0)); if (wrap.IsEmpty()) - return Undefined(); + return scope.Close( Undefined() ); SkinOption *tmp = (SkinOption *) wrap->Value(); if (tmp == NULL) - return Undefined(); + return scope.Close( Undefined() ); - return Int32::New(tmp->getMin()); + return scope.Close( Int32::New(tmp->getMin()) ); } static void Set_SkinOption_min(Local property, Local value, const AccessorInfo& info) { + HandleScope scope; + Local self = info.Holder(); Local wrap = Local::Cast(self->GetInternalField(0)); if (wrap.IsEmpty()) @@ -79,20 +87,24 @@ static void Set_SkinOption_min(Local property, Local value, const static Handle Get_SkinOption_max(Local property, const AccessorInfo &info) { + HandleScope scope; + Local self = info.Holder(); Local wrap = Local::Cast(self->GetInternalField(0)); if (wrap.IsEmpty()) - return Undefined(); + return scope.Close( Undefined() ); SkinOption *tmp = (SkinOption *) wrap->Value(); if (tmp == NULL) - return Undefined(); + return scope.Close( Undefined() ); - return Int32::New(tmp->getMax()); + return scope.Close( Int32::New(tmp->getMax()) ); } static void Set_SkinOption_max(Local property, Local value, const AccessorInfo& info) { + HandleScope scope; + Local self = info.Holder(); Local wrap = Local::Cast(self->GetInternalField(0)); if (wrap.IsEmpty()) @@ -109,26 +121,30 @@ static void Set_SkinOption_max(Local property, Local value, const static Handle Get_SkinOption_type(Local property, const AccessorInfo &info) { + HandleScope scope; + Local self = info.Holder(); Local wrap = Local::Cast(self->GetInternalField(0)); if (wrap.IsEmpty()) - return Undefined(); + return scope.Close( Undefined() ); SkinOption *tmp = (SkinOption *) wrap->Value(); if (tmp == NULL) - return Undefined(); + return scope.Close( Undefined() ); switch(tmp->getType()) { - case CHECKBOX: return String::New((const V8_TCHAR *) _T("CHECKBOX")); - case NUMBER: return String::New((const V8_TCHAR *) _T("NUMBER")); - case TEXT: return String::New((const V8_TCHAR *) _T("TEXT")); + case CHECKBOX: return scope.Close( String::New((const V8_TCHAR *) _T("CHECKBOX")) ); + case NUMBER: return scope.Close( String::New((const V8_TCHAR *) _T("NUMBER")) ); + case TEXT: return scope.Close( String::New((const V8_TCHAR *) _T("TEXT")) ); } - return Undefined(); + return scope.Close( Undefined() ); } static void Set_SkinOption_type(Local property, Local value, const AccessorInfo& info) { + HandleScope scope; + Local self = info.Holder(); Local wrap = Local::Cast(self->GetInternalField(0)); if (wrap.IsEmpty()) @@ -154,6 +170,8 @@ static void Set_SkinOption_type(Local property, Local value, cons void AddSkinOptionAcessors(Handle &templ) { + HandleScope scope; + templ->SetAccessor(String::New("description"), Get_SkinOption_description, Set_SkinOption_description); templ->SetAccessor(String::New("min"), Get_SkinOption_min, Set_SkinOption_min); templ->SetAccessor(String::New("max"), Get_SkinOption_max, Set_SkinOption_max); -- cgit v1.2.3