You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/10/18 17:48:03 UTC
svn propchange: r1023830 - svn:log
Author: hwright
Revision: 1023830
Modified property: svn:log
Modified: svn:log at Mon Oct 18 15:48:03 2010
------------------------------------------------------------------------------
--- svn:log (original)
+++ svn:log Mon Oct 18 15:48:03 2010
@@ -1,88 +1,10 @@
-Index: subversion/bindings/c++/include/Types.h
-===================================================================
---- subversion/bindings/c++/include/Types.h (revision 1023810)
-+++ subversion/bindings/c++/include/Types.h (working copy)
-@@ -80,14 +80,15 @@ class CStructWrapper
- inline
- CStructWrapper(const T *data)
- {
-- m_data = new RefCounter<T, DUP>(data);
-+ m_data = data ? new RefCounter<T, DUP>(data) : NULL;
- }
-
- inline
- CStructWrapper(const CStructWrapper<T, DUP> &that)
- {
- m_data = that.m_data;
-- m_data->inc_ref();
-+ if (m_data)
-+ m_data->inc_ref();
- }
-
- inline CStructWrapper<T, DUP>&
-@@ -96,27 +97,40 @@ class CStructWrapper
- // Self assignment
- if (&that == this)
- return *this;
--
-- m_data->dec_ref();
-- if (m_data->refs() == 0)
-- delete m_data;
-+
-+ if (m_data)
-+ {
-+ m_data->dec_ref();
-+ if (m_data->refs() == 0)
-+ delete m_data;
-+ }
-+
- m_data = that.m_data;
-- m_data->inc_ref();
-+ if (m_data)
-+ m_data->inc_ref();
-
- return *this;
- }
-
- inline ~CStructWrapper()
- {
-+ if (!m_data)
-+ return;
-+
- m_data->dec_ref();
- if (m_data->refs() == 0)
- delete m_data;
- }
-
-- inline const T& operator* () const { return *m_data->ptr(); }
-- inline const T* operator-> () const { return m_data->ptr(); }
-- inline operator T const *() const { return m_data->ptr(); }
-+ inline const T& operator* () const
-+ { return *m_data->ptr(); }
-
-+ inline const T* operator-> () const
-+ { return m_data ? m_data->ptr() : NULL; }
-+
-+ inline operator T const *() const
-+ { return m_data ? m_data->ptr() : NULL; }
-+
- private:
- RefCounter<T, DUP> *m_data;
- };
-Index: subversion/tests/libsvn++/util-test.cpp
-===================================================================
---- subversion/tests/libsvn++/util-test.cpp (revision 1023810)
-+++ subversion/tests/libsvn++/util-test.cpp (working copy)
-@@ -205,6 +205,12 @@ test_null_objects(apr_pool_t *p)
- if (lock)
- path = lock.getPath();
-
-+ Lock l2(lock);
-+
-+ Lock l3 = l2;
-+
-+ // To bad we can't do something interesting here and check for a segfault...
-+
- return SVN_NO_ERROR;
- }
-
+On the object-model branch:
+Better handle refcounting of NULL objects.
+
+* subversion/bindings/c++/include/Types.h
+ (CStructWrapper): Store the NULL object, instead of creating a Pool to wrap
+ it.
+ [other operators]: Adjust operation for a potential NULL reference.
+
+* subversion/tests/libsvn++/util-test.cpp
+ (test_null_objects): Add a few more scenarios.