I think I found the bug

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

I think I found the bug

parshin.da
I think I found the bug - there is no operator= in class "scope",
operator= generated by compiler is inappropriate in this case. In my
case I fixed it by the following patch:

--- a/luabind/luabind/scope.hpp
+++ b/luabind/luabind/scope.hpp
@@ -60,6 +60,8 @@ namespace luabind {
         scope(scope const& other_);
         ~scope();

+        scope& operator=( const scope& other_ );
+
         scope& operator,(scope s);

         void register_(lua_State* L) const;
diff --git a/luabind/src/scope.cpp b/luabind/src/scope.cpp
index 0050a91..c95f1a5 100755
--- a/luabind/src/scope.cpp
+++ b/luabind/src/scope.cpp
@@ -59,6 +59,14 @@ namespace luabind { namespace detail {
         const_cast<scope&>(other).m_chain = 0;
     }

+    scope& scope::operator=( const scope& other_ )
+    {
+        delete m_chain;
+        m_chain = other_.m_chain;
+        const_cast<scope&>(other_).m_chain = 0;
+        return *this;
+    }
+
     scope::~scope()
     {
         delete m_chain;


------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: I think I found the bug

Daniel Wallin
On Tue, Aug 24, 2010 at 12:40 PM, parshin.da <[hidden email]> wrote:
> I think I found the bug - there is no operator= in class "scope",
> operator= generated by compiler is inappropriate in this case. In my
> case I fixed it by the following patch:

Thanks! Applied on 0.9 branch:

  http://github.com/luabind/luabind/tree/0.9

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

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user