lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,all,
I think we need some thing like shared_form_this() in luabind::object.
If a class have a lua function object(luabind::object),like:
class A
{
public:
  A(){}

  callback()
  {
    funcobj_(this);--will crash here
OR:
   funcobj_(slef_);--alse crashed
  }
luabind::object funcobj_;
luabind::object self_;--is a luabind::object hold the ref of this obj

};



On Sun, Jan 4, 2009 at 23:10, Linker <linker.m.lin@gmail.com> wrote:
BUG Report:
luabind 0.8 release
lua 5.1.4
VC2008sp1

VC report:
  ntdll.dll!7c92120e()

  ntdll.dll!7c98c201()
  ntdll.dll!7c98c63e()
  ntdll.dll!7c9803b0()
  ntdll.dll!7c980484()
  kernel32.dll!7c85f8d7()
> msvcr90d.dll!_CrtIsValidHeapPointer(const void * pUserData=0x100ac868)  line 2103 C++
  msvcr90d.dll!_free_dbg_nolock(void * pUserData=0x100ac868, int nBlockUse=1)  line 1317 + 0x9 byte C++
  msvcr90d.dll!_free_dbg(void * pUserData=0x100ac868, int nBlockUse=1)  line 1258 + 0xd byte C++
  msvcr90d.dll!free(void * pUserData=0x100ac868)  line 49 + 0xb byte C++
  luai.exe!l_alloc(void * ud=0x00000000, void * ptr=0x100ac868, unsigned int osize=32, unsigned int nsize=0)  line 631 + 0xc byte C++
  luai.exe!luaM_realloc_(lua_State * L=0x00295da8, void * block=0x100ac868, unsigned int osize=32, unsigned int nsize=0)  line 79 + 0x1d byte C++
  luai.exe!luaH_free(lua_State * L=0x00295da8, Table * t=0x002bc800)  line 376 + 0x2d byte C++
  luai.exe!freeobj(lua_State * L=0x00295da8, GCObject * o=0x002bc800)  line 383 + 0xd byte C++
  luai.exe!sweeplist(lua_State * L=0x00295da8, GCObject * * p=0x002bc618, unsigned int count=37)  line 424 + 0xd byte C++
  luai.exe!singlestep(lua_State * L=0x00295da8)  line 583 + 0x12 byte C++
  luai.exe!luaC_fullgc(lua_State * L=0x00295da8)  line 656 + 0x9 byte C++
  luai.exe!lua_gc(lua_State * L=0x00295da8, int what=2, int data=""  line 914 + 0x9 byte C++
  luai.exe!docall(lua_State * L=0x00295da8, int narg=0, int clear=0)  line 116 + 0x13 byte C++
  luai.exe!dotty(lua_State * L=0x00295da8)  line 246 + 0x13 byte C++
  luai.exe!pmain(lua_State * L=0x00295da8)  line 411 + 0x9 byte C++
  luai.exe!luaD_precall(lua_State * L=0x00295da8, lua_TValue * func=0x00292a60, int nresults=0)  line 319 + 0x16 byte C++
  luai.exe!luaD_call(lua_State * L=0x00295da8, lua_TValue * func=0x00292a60, int nResults=0)  line 376 + 0x11 byte C++
  luai.exe!f_Ccall(lua_State * L=0x00295da8, void * ud=0x00ddff28)  line 846 + 0x15 byte C++
  luai.exe!luaD_rawrunprotected(lua_State * L=0x00295da8, void (lua_State *, void *)* f=0x00405220, void * ud=0x00ddff28)  line 118 + 0xd byte C++
  luai.exe!luaD_pcall(lua_State * L=0x00295da8, void (lua_State *, void *)* func=0x00405220, void * u=0x00ddff28, int old_top=16, int ef=0)  line 463 + 0x11 byte C++
  luai.exe!lua_cpcall(lua_State * L=0x00295da8, int (lua_State *)* func=0x00401220, void * ud=0x00ddff54)  line 856 + 0x21 byte C++
  luai.exe!main(int argc=4, char * * argv=0x00295d20)  line 437 + 0x12 byte C++
  luai.exe!__tmainCRTStartup()  line 586 + 0x19 byte C
  luai.exe!mainCRTStartup()  line 403 C
  kernel32.dll!7c817067()

lua part:
require'asio'

t=a.timer()
local n=1
collectgarbage('stop')
local f;f=function(t,e)
local t={'hi~'}-- this line make VC report heap crash
if e=='timeout' then

t:start(f,1000)

n=n+1

print'hi~'

if n>3 then t:cancel() end

else

print(t,e)

end
end
t:start(f,1000)
a.ios_run();

--------------------------------------------------------------------
I think maybe it's gc bug.

On Sun, Jan 4, 2009 at 19:57, Daniel Wallin <daniel@boostpro.com> wrote:
I'm happy to announce the release of luabind 0.8. Most of the
changes since the last release have happened under the hood,
but a number of new features has been added as well.

As usual, source packages available for download at:

 http://sourceforge.net/project/showfiles.php?group_id=77060

Bug reports and questions should go to the mailing list:

 https://lists.sourceforge.net/lists/listinfo/luabind-user

User visible changes since 0.7.1
--------------------------------

 * Added ability to explicity specify the signature of the
  exported function. This additionally means that it's now
  possible to export function objects.

 * Added ability to register translation of custom exception
  classes.

 * Added customization point to allow native conversion of
  user defined types.

 * Added support for exporting the # operator.

 * Expanded the API wrapper interface with more functions and
  a light weight alternative to `object': `argument'.

 * Properties now goes through the same function dispatch
  code as all other functions, and now properly handles
  exceptions.

Breaking changes
----------------

 * Dropped support for old compilers. Anything that doesn't
  handle partial specialization won't work anymore. This
  means no more VC6.5 and VC7.0.

 * `super()' was deprecated in favor of directly calling the
  base class `__init()' function. The deprecation error can
  be turned off by calling `luabind::disable_super_deprecation()'
  before `super()' is used.

 * The user defined converter mechanism was removed in favor
  of the new customization point.

 * Format of error messages was changed.

Changes since 0.7.1:
--------------------

Daniel Wallin (74):
 Refactored temporary holder construction in converters.
 Added new exception_handler code.
 Removed duplicated exception handlers.
 Added test for user defined exception handlers.
 Handle `luabind:error` specially.
 Changed expected error messages from exceptions.
 Documented exception handler mechanism.
 Updated .gitignore with build directories.
 Add support for exporting the # operator.
 Add getmetatable() and setmetatable() functions.
 Add more API wrappers to object.hpp.
 Add missing includes.
 Remove stale object_init code.
 Add "argument" API wrapper class.
 Make all object-like types bool-convertible.
 Rewrite copy_policy in terms of value_converter.
 Test copy_policy with T const*.
 Add signature deduction function template.
 Reimplement "call" template.
 Add missing includes.
 Convert "class" and "property" to new call code.
 Add compute_score() and compute_arity() helpers.
 Use compute_score() instead of match().
 Use compute_score() and invoke() in function.hpp.
 Add constructor<>::signature MPL sequence.
 Use compute_score() when invoking constructors.
 Add missing include and namespace alias.
 Don't try to link to versioned .so.
 Reimplement the function registration code.
 Use new function dispatch code for member functions.
 Fix calling virtual functions without override.
 Remove old function dispatch code completely.
 Add missing include.
 Reimplement constructor code.
 Change constructor signature to include self argument.
 Change super() to always just call the __init() function.
 Change derived class name-shadowing rules.
 Fix destruction of derived Lua classes.
 Rewrite construction code to always just call __init().
 Unify construction of Lua and C++ classes.
 Deprecate "super()".
 Added `property_tag()`.
 Call "get" and "set" property functions.
 Changed use of std::string to lua_pushfstring().
 Added "property()" Lua function.
 Add interface to explicitly specify signatures.
 Add test that demonstrates adopt() bug.
 Test that properties can be added to Lua instances.
 Removed worthless gettable/settable metamethods.
 Add "property()" API wrapper.
 Turn "is_primitive" into a proper metafunction.
 Use the new property system in class_.
 Make using dependency() on non class return types a nop.
 Add function name to signature string.
 Add signature type name for object and argument.
 Get rid of unused global variable warning.
 Fix expected error messages in tests.
 Remove commented out "functor" converter.
 Simplify converters and add customization point.
 Remove old user-defined converters.
 Document the new converter customization point.
 Change private destructor test to use factory function.
 Remove obsolete typedef from converters.
 Fix GCC 'suggest parentheses' warning.
 Add '__len' to list of overloadable operators.
 Document 'tag_function'.
 Really get rid of unused global warning.
 Add test that demonstrates adopt() bug.
 Use correct index in inject_backref().
 Fix adopt() bug when used with wrapper class.
 Change test to use polymorphic type derived from wrap_base.
 Always use __declspec(dllimport/dllexport) on Windows.
 Move LUABIND_BUILDING define from Jamroot to source files.
 docs: Add note about LUABIND_DYNAMIC_LINK.

Nikolas Bowe (1):
 Fix adopt bug when used with derived Lua classes.

Rodolfo Lima (1):
 Synchronize the declaration of class_base::init with its definition.

--
Daniel Wallin
BoostPro Computing
http://www.boostpro.com




--
Regards,
Linker Lin
linker.m.lin@gmail.com



--
Regards,
Linker Lin
linker.m.lin@gmail.com