コード例 #1
0
LuaStackChecker* LuaStateAccess::getLuaStackChecker(lua_State* L)
{
    ExtraLuaStateData* extra = (ExtraLuaStateData*)((char*)(L) - sizeof(ExtraLuaStateData));
    
    if (extra->stackChecker == NULL)
    {
        OwningPtr<LuaStackChecker> stackChecker = LuaStackChecker::create();
        LuaStateAccess_HeapObjectRefManipulator::incRefCounter(stackChecker);
        extra->stackChecker = stackChecker.getRawPtr();
    }
    return (LuaStackChecker*) extra->stackChecker;
}
コード例 #2
0
ファイル: WeakPtr.hpp プロジェクト: BackupTheBerlios/luced
    WeakPtr(const OwningPtr<T>& src) {
        if (src.isValid()) {
            ptr = src.getRawPtr();
#ifdef WEAK_PTR_HAS_EXTRA_PTR_TO_COUNTERS
            heapObjectCounters = HeapObjectRefManipulator::getHeapObjectCounters(ptr);
#endif
            HeapObjectRefManipulator::incWeakCounter(getHeapObjectCounters());
        } else {
            ptr = NULL;
#ifdef WEAK_PTR_HAS_EXTRA_PTR_TO_COUNTERS
            heapObjectCounters = NULL;
#endif
        }
    }
コード例 #3
0
OwningPtr<LuaStackChecker> LuaStateAccess::replaceLuaStackChecker(lua_State* L, OwningPtr<LuaStackChecker> newStackChecker)
{
    ExtraLuaStateData* extra = (ExtraLuaStateData*)((char*)(L) - sizeof(ExtraLuaStateData));
    
    OwningPtr<LuaStackChecker> oldStackChecker;
    
    if (extra->stackChecker != NULL)
    {
        {
            LuaStackChecker* p = (LuaStackChecker*) extra->stackChecker;
            LuaStateAccess_HeapObjectRefManipulator::resetInitialOwnership(p);
            oldStackChecker = OwningPtr<LuaStackChecker>(p);
            // no decRefCounter, because OwningPtr takes given Ownerchip
        }
        
        LuaStateAccess_HeapObjectRefManipulator::incRefCounter(newStackChecker);
        extra->stackChecker = newStackChecker.getRawPtr();
    }
    return oldStackChecker;
}