bddprint: do not store a global shared_ptr to the bdd_dict

* src/twa/bddprint.cc: Do not store a global shared_ptr to the bdddict
used for printing (a simple pointer is enough), otherwise it risks being
the last shared_ptr to be destroyed, and it might be destroyed after the
unicity maps of the formulas.
This commit is contained in:
Alexandre Duret-Lutz 2015-09-29 19:59:02 +02:00
parent c67540db14
commit ca95e4d1d2

View file

@ -31,7 +31,7 @@
namespace spot namespace spot
{ {
/// Global dictionary used by print_handler() to lookup variables. /// Global dictionary used by print_handler() to lookup variables.
static bdd_dict_ptr dict; static bdd_dict* dict;
/// Global flag to enable Acc[x] output (instead of `x'). /// Global flag to enable Acc[x] output (instead of `x').
static bool want_acc; static bool want_acc;
@ -100,7 +100,7 @@ namespace spot
std::ostream& std::ostream&
bdd_print_sat(std::ostream& os, const bdd_dict_ptr& d, bdd b) bdd_print_sat(std::ostream& os, const bdd_dict_ptr& d, bdd b)
{ {
dict = d; dict = d.get();
where = &os; where = &os;
want_acc = false; want_acc = false;
assert(bdd_satone(b) == b); assert(bdd_satone(b) == b);
@ -124,7 +124,7 @@ namespace spot
std::ostream& std::ostream&
bdd_print_accset(std::ostream& os, const bdd_dict_ptr& d, bdd b) bdd_print_accset(std::ostream& os, const bdd_dict_ptr& d, bdd b)
{ {
dict = d; dict = d.get();
where = &os; where = &os;
want_acc = true; want_acc = true;
first_done = false; first_done = false;
@ -153,7 +153,7 @@ namespace spot
std::ostream& std::ostream&
bdd_print_set(std::ostream& os, const bdd_dict_ptr& d, bdd b) bdd_print_set(std::ostream& os, const bdd_dict_ptr& d, bdd b)
{ {
dict = d; dict = d.get();
want_acc = true; want_acc = true;
bdd_strm_hook(print_handler); bdd_strm_hook(print_handler);
os << bddset << b; os << bddset << b;
@ -192,7 +192,7 @@ namespace spot
std::ostream& std::ostream&
bdd_print_isop(std::ostream& os, const bdd_dict_ptr& d, bdd b) bdd_print_isop(std::ostream& os, const bdd_dict_ptr& d, bdd b)
{ {
dict = d; dict = d.get();
want_acc = true; want_acc = true;
minato_isop isop(b); minato_isop isop(b);
@ -201,7 +201,6 @@ namespace spot
{ {
os << bdd_format_set(d, p); os << bdd_format_set(d, p);
} }
return os; return os;
} }