Ignore:
Timestamp:
09/17/14 14:58:46 (11 years ago)
Author:
epyon
Message:
  • NV_LUA_STACKASSERT -> NV_LUA_STACK_ASSERT
  • asserts for lua_handle
  • bugfix in gl_context that prevented framebuffer release
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lua/lua_handle.cc

    r333 r335  
    77#include "nv/lua/lua_handle.hh"
    88
     9#include "nv/lua/lua_state.hh"
    910#include "nv/lua/lua_raw.hh"
    1011
     
    1213void nv::lua::detail::push_handle_impl( lua_State* L, int pseudoindex, uint32 index )
    1314{
    14         int stack = lua_gettop(L);
     15        NV_LUA_STACK_ASSERT( L, +1 );
    1516        lua_rawgeti( L, LUA_REGISTRYINDEX, pseudoindex ); // table
    1617        lua_rawgeti( L, -1, index );                      // table, entry
    17         if ( lua_isnil( L, -1 ) )
     18        if ( !lua_istable( L, -1 ) )
    1819        {
    1920                NV_LOG( nv::LOG_ERROR, "NIL" );
     21                lua_pop( L, 2 );
     22                lua_pushnil( L );
     23                return;
    2024        }
    21         lua_replace( L, stack + 1 );
    22         lua_settop( L, stack + 1 );
     25        lua_replace( L, -2 );
    2326}
    2427
    2528nv::lua::detail::handle_struct nv::lua::detail::to_handle_impl( lua_State* L, int i, uint32 dindex, uint32 dcounter )
    2629{
     30        NV_LUA_STACK_ASSERT( L, 0 );
    2731        handle_conversion hc;
    2832        hc.h.index   = dindex;
     
    5963void nv::lua::detail::unregister_handle_impl( lua_State* L, int pseudoindex, uint32 index )
    6064{
    61         int stack = lua_gettop(L);
     65        NV_LUA_STACK_ASSERT( L, 0 );
    6266        lua_rawgeti( L, LUA_REGISTRYINDEX, pseudoindex ); // table
    6367        lua_pushinteger( L, 0 );
    6468        lua_rawseti( L, -2, index );
    65         lua_settop( L, stack );
     69        lua_pop( L, 1 );
    6670}
Note: See TracChangeset for help on using the changeset viewer.