$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Andreas Pokorny (andreas.pokorny_at_[hidden])
Date: 2005-10-12 10:57:09
Hi,
We just stumbled across a small problem with Boost.Signals,
while playing with the symbol visibility features of gcc-3.4 and
gcc-4. That feature is still buggy, but it unveiled some strange
code.
Somehow gcc failed to turn the type info of the types stored by any
into a visible symbol, which is required for using boost::signals
across shared libraries. So there are multiple type info objects and
the dynamic_casts within signal failed, and the application crashed
with a seg fault, since no one expected the cast to fail
The code is in signal_template.hpp:
template<typename Pair>
R operator()(const Pair& slot) const {
F* target = const_cast<F*>(any_cast<F>(&slot.second));
return (*target)(BOOST_SIGNALS_BOUND_ARGS);
}
I dont see why any_cast is used here at all. The type safety
is guranteed by the interface of Boost.Signals, so I doubt that
someone will be able to abuse the library. I believe the author
of that code had the same in mind, since he did not test
target != 0 before invoking the target. So in my opinion a
simple reinterpret_cast should suffice here. It would also
fix our issue, although that one is caused by gcc.
Regards
Andreas Pokorny