You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2012/05/12 23:23:00 UTC
svn commit: r1337689 - /subversion/trunk/subversion/libsvn_ra_serf/xml.c
Author: gstein
Date: Sat May 12 21:23:00 2012
New Revision: 1337689
URL: http://svn.apache.org/viewvc?rev=1337689&view=rev
Log:
Clear the scratch pool within the xml context. This also requires some
debug code to ensure we haven't re-entered the context and might be
claering an outer call's use of the pool.
* subversin/libsvn_ra_serf/xml.c:
(START_CALLBACK, END_CALLBACK): helper macros to manipulate the
debug-only flag within the context
(svn_ra_serf__xml_context_t): add WITHIN_CALLBACK for debugging
(svn_ra_serf__xml_cb_start, svn_ra_serf__xml_cb_end): wrap the
callback invocation with callback flag markers. clear the scratch
pool after the invocation.
Modified:
subversion/trunk/subversion/libsvn_ra_serf/xml.c
Modified: subversion/trunk/subversion/libsvn_ra_serf/xml.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/xml.c?rev=1337689&r1=1337688&r2=1337689&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/xml.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/xml.c Sat May 12 21:23:00 2012
@@ -63,6 +63,23 @@ struct svn_ra_serf__xml_context_t {
/* Linked list of free states. */
svn_ra_serf__xml_estate_t *free_states;
+#ifdef SVN_DEBUG
+ /* Used to verify we are not re-entering a callback, specifically to
+ ensure SCRATCH_POOL is not cleared while an outer callback is
+ trying to use it. */
+ svn_boolean_t within_callback;
+#define START_CALLBACK(xmlctx) \
+ do { \
+ svn_ra_serf__xml_context_t *xmlctx__tmp = (xmlctx); \
+ SVN_ERR_ASSERT(!xmlctx__tmp->within_callback); \
+ xmlctx__tmp->within_callback = TRUE; \
+ } while (0)
+#define END_CALLBACK(xmlctx) ((xmlctx)->within_callback = FALSE)
+#else
+#define START_CALLBACK(xmlctx) /* empty */
+#define END_CALLBACK(xmlctx) /* empty */
+#endif /* SVN_DEBUG */
+
apr_pool_t *scratch_pool;
};
@@ -616,8 +633,13 @@ svn_ra_serf__xml_cb_start(svn_ra_serf__x
xmlctx->current = new_xes;
if (scan->custom_open)
- SVN_ERR(xmlctx->opened_cb(new_xes, xmlctx->baton,
- new_xes->state, xmlctx->scratch_pool));
+ {
+ START_CALLBACK(xmlctx);
+ SVN_ERR(xmlctx->opened_cb(new_xes, xmlctx->baton,
+ new_xes->state, xmlctx->scratch_pool));
+ END_CALLBACK(xmlctx);
+ svn_pool_clear(xmlctx->scratch_pool);
+ }
return SVN_NO_ERROR;
}
@@ -673,9 +695,12 @@ svn_ra_serf__xml_cb_end(svn_ra_serf__xml
else
cdata = NULL;
+ START_CALLBACK(xmlctx);
SVN_ERR(xmlctx->closed_cb(xes, xmlctx->baton, xes->state,
cdata, xes->attrs,
xmlctx->scratch_pool));
+ END_CALLBACK(xmlctx);
+ svn_pool_clear(xmlctx->scratch_pool);
}
/* Pop the state. */