[sigc] Segfault after calling signal.clear() from signal handler



Hi,

    My issue might be related to previous posts about "signal_impl::clear()" and maybe even 
"sigc::internal::signal_emit1 SIGSEGV".

    Namely, the following code fails with segmentation fault:

            sigc::signal<void> sig;
            sig.connect([&sig]() { sig.clear(); } );
            sig();

    However it does not fail if handler is disconnected using:

        sig = sigc::signal<void>();

    or when sigc::connection is used to disconnect the signal/handler linkage.

    Worth to note that sigc::slot doesn't have the same problem, it can be safely disconnected from inside 
the handler using slot.disconnect().

    Is it a bug or some undocumented limitation? It might not be very logical thing to clear all slots 
connected to the signal from one of its handlers though. If that is the case, I think at least docs should 
tell that.

    I reproduced the issue on 2.8.0 and 2.9.3.  Didn't try 2.99 yet.


BR, Andrey



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]