replace ::cast_dynamic() with relevant ActionManager::get_*_action() calls
[ardour.git] / tools / boost-ptr-debug.patch
1 --- shared_ptr.hpp.clean        2014-03-12 10:32:10.054102239 -0400
2 +++ shared_ptr.hpp      2014-03-12 10:34:09.413172291 -0400
3 @@ -51,6 +51,13 @@
4  #endif
5  #endif
6  
7 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
8 +void boost_debug_shared_ptr_operator_equals (void const *, void const *, int, void const*, int);
9 +void boost_debug_shared_ptr_reset (void const *, void const *, int, void const*, int);
10 +void boost_debug_shared_ptr_destructor (void const *, void const *, int);
11 +void boost_debug_shared_ptr_constructor (void const *, void const *, int);
12 +#endif
13 +
14  namespace boost
15  {
16  
17 @@ -177,12 +184,31 @@
18  
19      shared_ptr(): px(0), pn() // never throws in 1.30+
20      {
21 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
22 +        boost_debug_shared_ptr_constructor (this, px, use_count());
23 +#endif
24 +    }
25 +
26 +    ~shared_ptr()
27 +    {
28 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
29 +       boost_debug_shared_ptr_destructor (this, get(), use_count()); 
30 +#endif
31 +    }
32 +
33 +    shared_ptr(const shared_ptr<T>& r ) : px (r.px), pn (r.pn) {
34 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
35 +           boost_debug_shared_ptr_constructor (this, px, use_count());
36 +#endif
37      }
38  
39      template<class Y>
40      explicit shared_ptr( Y * p ): px( p ), pn( p ) // Y must be complete
41      {
42          boost::detail::sp_enable_shared_from_this( this, p, p );
43 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
44 +        boost_debug_shared_ptr_constructor (this, px, use_count());
45 +#endif
46      }
47  
48      //
49 @@ -193,7 +219,10 @@
50  
51      template<class Y, class D> shared_ptr(Y * p, D d): px(p), pn(p, d)
52      {
53 -        boost::detail::sp_enable_shared_from_this( this, p, p );
54 +        boost::detail::sp_enable_shared_from_this( this, p, p );        
55 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
56 +       boost_debug_shared_ptr_constructor (this, px, use_count());
57 +#endif
58      }
59  
60      // As above, but with allocator. A's copy constructor shall not throw.
61 @@ -201,6 +230,9 @@
62      template<class Y, class D, class A> shared_ptr( Y * p, D d, A a ): px( p ), pn( p, d, a )
63      {
64          boost::detail::sp_enable_shared_from_this( this, p, p );
65 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
66 +        boost_debug_shared_ptr_constructor (this, px, use_count());
67 +#endif
68      }
69  
70  //  generated copy constructor, destructor are fine...
71 @@ -220,6 +252,9 @@
72      {
73          // it is now safe to copy r.px, as pn(r.pn) did not throw
74          px = r.px;
75 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
76 +        boost_debug_shared_ptr_constructor (this, px, use_count());
77 +#endif
78      }
79  
80      template<class Y>
81 @@ -229,6 +264,9 @@
82          {
83              px = r.px;
84          }
85 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
86 +        boost_debug_shared_ptr_constructor (this, px, use_count());
87 +#endif
88      }
89  
90      template<class Y>
91 @@ -243,22 +281,34 @@
92  #endif
93      : px( r.px ), pn( r.pn ) // never throws
94      {
95 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
96 +        boost_debug_shared_ptr_constructor (this, px, use_count());
97 +#endif
98      }
99  
100      // aliasing
101      template< class Y >
102      shared_ptr( shared_ptr<Y> const & r, T * p ): px( p ), pn( r.pn ) // never throws
103      {
104 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
105 +        boost_debug_shared_ptr_constructor (this, px, use_count());
106 +#endif
107      }
108  
109      template<class Y>
110      shared_ptr(shared_ptr<Y> const & r, boost::detail::static_cast_tag): px(static_cast<element_type *>(r.px)), pn(r.pn)
111      {
112 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
113 +        boost_debug_shared_ptr_constructor (this, px, use_count());
114 +#endif
115      }
116  
117      template<class Y>
118      shared_ptr(shared_ptr<Y> const & r, boost::detail::const_cast_tag): px(const_cast<element_type *>(r.px)), pn(r.pn)
119      {
120 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
121 +        boost_debug_shared_ptr_constructor (this, px, use_count());
122 +#endif
123      }
124  
125      template<class Y>
126 @@ -268,6 +318,9 @@
127          {
128              pn = boost::detail::shared_count();
129          }
130 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
131 +        boost_debug_shared_ptr_constructor (this, px, use_count());
132 +#endif
133      }
134  
135      template<class Y>
136 @@ -277,6 +330,9 @@
137          {
138              boost::throw_exception(std::bad_cast());
139          }
140 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
141 +        boost_debug_shared_ptr_constructor (this, px, use_count());
142 +#endif
143      }
144  
145  #ifndef BOOST_NO_AUTO_PTR
146 @@ -287,6 +343,9 @@
147          Y * tmp = r.get();
148          pn = boost::detail::shared_count(r);
149          boost::detail::sp_enable_shared_from_this( this, tmp, tmp );
150 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
151 +        boost_debug_shared_ptr_constructor (this, px, use_count());
152 +#endif
153      }
154  
155  #if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
156 @@ -297,6 +356,9 @@
157          typename Ap::element_type * tmp = r.get();
158          pn = boost::detail::shared_count( r );
159          boost::detail::sp_enable_shared_from_this( this, tmp, tmp );
160 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
161 +        boost_debug_shared_ptr_constructor (this, px, use_count());
162 +#endif
163      }
164  
165  
166 @@ -308,6 +370,9 @@
167  
168      shared_ptr & operator=( shared_ptr const & r ) // never throws
169      {
170 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
171 +       boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
172 +#endif
173          this_type(r).swap(*this);
174          return *this;
175      }
176 @@ -317,6 +382,9 @@
177      template<class Y>
178      shared_ptr & operator=(shared_ptr<Y> const & r) // never throws
179      {
180 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
181 +       boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
182 +#endif
183          this_type(r).swap(*this);
184          return *this;
185      }
186 @@ -328,6 +396,9 @@
187      template<class Y>
188      shared_ptr & operator=( std::auto_ptr<Y> & r )
189      {
190 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
191 +        boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
192 +#endif
193          this_type(r).swap(*this);
194          return *this;
195      }
196 @@ -354,6 +425,9 @@
197      {
198          pn.swap( r.pn );
199          r.px = 0;
200 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
201 +        boost_debug_shared_ptr_constructor (this, px, use_count());
202 +#endif
203      }
204  
205      template<class Y>
206 @@ -370,10 +444,16 @@
207      {
208          pn.swap( r.pn );
209          r.px = 0;
210 ++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
211 ++          boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
212 ++#endif
213      }
214  
215      shared_ptr & operator=( shared_ptr && r ) // never throws
216      {
217 ++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
218 ++          boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
219 ++#endif
220          this_type( static_cast< shared_ptr && >( r ) ).swap( *this );
221          return *this;
222      }
223 @@ -381,6 +461,9 @@
224      template<class Y>
225      shared_ptr & operator=( shared_ptr<Y> && r ) // never throws
226      {
227 ++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
228 ++          boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
229 ++#endif
230          this_type( static_cast< shared_ptr<Y> && >( r ) ).swap( *this );
231          return *this;
232      }
233 @@ -389,27 +472,42 @@
234  
235      void reset() // never throws in 1.30+
236      {
237 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
238 +           boost_debug_shared_ptr_reset (this, get(), use_count(), 0, 0);
239 +#endif
240          this_type().swap(*this);
241      }
242  
243      template<class Y> void reset(Y * p) // Y must be complete
244      {
245          BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors
246 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
247 +       boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
248 +#endif
249          this_type(p).swap(*this);
250      }
251  
252      template<class Y, class D> void reset( Y * p, D d )
253      {
254 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
255 +           boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
256 +#endif
257          this_type( p, d ).swap( *this );
258      }
259  
260      template<class Y, class D, class A> void reset( Y * p, D d, A a )
261      {
262 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
263 +           boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
264 +#endif
265          this_type( p, d, a ).swap( *this );
266      }
267  
268      template<class Y> void reset( shared_ptr<Y> const & r, T * p )
269      {
270 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
271 +           boost_debug_shared_ptr_reset (this, get(), use_count(), r.get(), r.use_count());
272 +#endif
273          this_type( r, p ).swap( *this );
274      }
275