On Thursday 15 August 2002 11:08 am, Lars Gullik Bjønnes wrote:
> | Ahhh. I'd forgotten about that. Did you manage to isolate the problem and
> | tell boost the list about it?
>
> No.

Well then, the trick is to replace 
        static boost::signal0<void> some_signal;
with a static method returning a reference to a signal:
        static boost::signal0<void> & some_signal();
and to get this method to initialise the boost::signal0<void> dynamically.

Will this do the trick:

template<typename Signal>
class BugfixSignal {
public:
        Signal & operator()() { return thesignal(); }
        Signal const & operator()() const { return thesignal(); }

private:
        Signal & thesignal() const
        {
                if (!signal_.get())
                        signal_.reset(new Signal);
                return *signal_;
        }

        boost::scoped_ptr<Signal> signal_;
};

class Dialogs {
public:
        static boost::signal0<void> & redrawGUI();
};

boost::signal0<void> & Dialogs::redrawGUI()
{
        static BugfixSignal<boost::signal0<void> > thesignal;
        return thesignal();
}

Reply via email to