From e07830d0f5932020abb6f9df22f82a18c6f5eb0a Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Sun, 11 Aug 2013 14:23:36 -0700 Subject: [PATCH] Fix nasty crash that only happens when using cygwin. Signed-off-by: Leonardo de Moura --- src/util/rc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util/rc.h b/src/util/rc.h index a3dcd1048..66af36c0b 100644 --- a/src/util/rc.h +++ b/src/util/rc.h @@ -34,9 +34,10 @@ void dec_ref() { if (dec_ref_core()) dealloc(); } #define LEAN_COPY_REF(T, Arg) \ if (Arg.m_ptr) \ Arg.m_ptr->inc_ref(); \ + auto new_ptr = Arg.m_ptr; \ if (m_ptr) \ m_ptr->dec_ref(); \ - m_ptr = Arg.m_ptr; \ + m_ptr = new_ptr; \ return *this; #define LEAN_MOVE_REF(T, Arg) \