Oberon00 / luabind

Luabind is a library that helps you create bindings between C++ and Lua.
http://oberon00.github.io/luabind/
Other
46 stars 13 forks source link

Consider calling the function in constructor not in destructor to fix exceptions handling #28

Closed Bertram25 closed 9 years ago

Bertram25 commented 9 years ago

As seen there: https://github.com/luabind/luabind/pull/26 https://github.com/azurepine/luabind/commit/c6f764725466c7d33d8ef7a7901418504eec1e26

I'll import that patch on my fork and can make a fixed PR if you want.

Oberon00 commented 9 years ago

It seems these patches are not applicable to my fork (which is based on the 0.9 branch of luabind, not the master branch). Since LUABIND_MAY_THROW solves the problem of std::terminate being called when an exception is thrown from one of these dtors, I do not see a real problem here, although it is bad style. I currently don't want to do more than fix bugs in luabind, so if you want this included you will have to provide a pull request. But can this patch be ported at all w/o variadic templates (C++11 support must not be required for Luabind)?

Bertram25 commented 9 years ago

Since LUABIND_MAY_THROW solves the problem of std::terminate being called when an exception is thrown from one of these dtors, I do not see a real problem here

This is my main issue, so I'll test this again and hopefully your fix should help. :)

I do not see a real problem here, although it is bad style. I currently don't want to do more than fix bugs in luabind

I can understand that.

But can this patch be ported at all w/o variadic templates (C++11 support must not be required for Luabind)?

I guess boost::tuple can be used for variadic templates when c++11 support is not there but you're right. @azurepine 's work doesn't look like handling that case. I would need to check the status of your fork and rework the patch from 0. Since the main issue looks fixed, I'll close it now. Whenever I'll have the time to play with all that, I'll come back with a PR.

Bertram25 commented 9 years ago

Thanks!