Changeset 335


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
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/lua/lua_state.hh

    r334 r335  
    2424
    2525#ifdef NV_DEBUG
    26 #define NV_LUA_STACKASSERT( state, value ) nv::lua::stack_assert __lua_stack_assert( state, value );
     26#define NV_LUA_STACK_ASSERT( state, value ) nv::lua::stack_assert __lua_stack_assert( state, value );
    2727#else
    28 #define NV_LUA_STACKASSERT( state, value )
     28#define NV_LUA_STACK_ASSERT( state, value )
    2929#endif
    3030
  • trunk/src/gl/gl_context.cc

    r331 r335  
    6363                        glDeleteRenderbuffers( 1, &info->depth_rb_glid );
    6464                glDeleteFramebuffers( 1, &info->glid );
     65                m_framebuffers.destroy( f );
    6566        }
    6667}
  • trunk/src/lua/lua_area.cc

    r334 r335  
    403403static int luaopen_area( lua_State * L )
    404404{
    405         NV_LUA_STACKASSERT( L, 0 );
     405        NV_LUA_STACK_ASSERT( L, 1 );
    406406        static const struct luaL_Reg nlua_area_sf [] = {
    407407                { "new",            nlua_area_new },
  • 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.