Critical fix to temporary destruction order

This commit is contained in:
John Wiegley 2012-03-11 05:09:06 -05:00
parent 62c04deb87
commit fcc68a0041
3 changed files with 11 additions and 2 deletions

View file

@ -50,8 +50,9 @@ class post_t;
class account_t; class account_t;
template <typename T> template <typename T>
struct item_handler : public noncopyable class item_handler : public noncopyable
{ {
protected:
shared_ptr<item_handler> handler; shared_ptr<item_handler> handler;
public: public:

View file

@ -372,6 +372,7 @@ public:
} }
virtual ~anonymize_posts() { virtual ~anonymize_posts() {
TRACE_DTOR(anonymize_posts); TRACE_DTOR(anonymize_posts);
handler.reset();
} }
void render_commodity(amount_t& amt); void render_commodity(amount_t& amt);
@ -451,6 +452,7 @@ public:
} }
virtual ~collapse_posts() { virtual ~collapse_posts() {
TRACE_DTOR(collapse_posts); TRACE_DTOR(collapse_posts);
handler.reset();
} }
void create_accounts() { void create_accounts() {
@ -539,6 +541,7 @@ public:
virtual ~display_filter_posts() { virtual ~display_filter_posts() {
TRACE_DTOR(display_filter_posts); TRACE_DTOR(display_filter_posts);
handler.reset();
} }
void create_accounts() { void create_accounts() {
@ -595,6 +598,7 @@ public:
virtual ~changed_value_posts() { virtual ~changed_value_posts() {
TRACE_DTOR(changed_value_posts); TRACE_DTOR(changed_value_posts);
handler.reset();
} }
void create_accounts() { void create_accounts() {
@ -671,6 +675,7 @@ public:
} }
virtual ~subtotal_posts() { virtual ~subtotal_posts() {
TRACE_DTOR(subtotal_posts); TRACE_DTOR(subtotal_posts);
handler.reset();
} }
void report_subtotal(const char * spec_fmt = NULL, void report_subtotal(const char * spec_fmt = NULL,
@ -849,6 +854,7 @@ public:
} }
virtual ~transfer_details() { virtual ~transfer_details() {
TRACE_DTOR(transfer_details); TRACE_DTOR(transfer_details);
handler.reset();
} }
virtual void operator()(post_t& post); virtual void operator()(post_t& post);
@ -908,6 +914,7 @@ public:
virtual ~generate_posts() { virtual ~generate_posts() {
TRACE_DTOR(generate_posts); TRACE_DTOR(generate_posts);
handler.reset();
} }
void add_period_xacts(period_xacts_list& period_xacts); void add_period_xacts(period_xacts_list& period_xacts);
@ -995,6 +1002,7 @@ class inject_posts : public item_handler<post_t>
virtual ~inject_posts() throw() { virtual ~inject_posts() throw() {
TRACE_DTOR(inject_posts); TRACE_DTOR(inject_posts);
handler.reset();
} }
virtual void operator()(post_t& post); virtual void operator()(post_t& post);

View file

@ -169,8 +169,8 @@ protected:
journal_posts_iterator journal_posts; journal_posts_iterator journal_posts;
xacts_iterator xacts; xacts_iterator xacts;
xact_posts_iterator posts; xact_posts_iterator posts;
temporaries_t temps;
xacts_list xact_temps; xacts_list xact_temps;
temporaries_t temps;
public: public:
posts_commodities_iterator() {} posts_commodities_iterator() {}