Project

General

Profile

Actions

Bug #2313

closed

Undefined behavior in UtilSignal::DestructInHandler test case

Added by Davide Pesavento over 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Utils
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
1.00 h

Description

Reduced testcase:

  unique_ptr<SignalOwner0> so(new SignalOwner0);
  so->sig.connect([&] {
    so.reset();
  });
  BOOST_CHECK_NO_THROW(so->emitSignal(sig));

The .reset() in the handler causes the deallocation of the signal, therefore everything that happens in Signal::operator() after this handler has run is undefined behavior.

Deallocating a signal from one of its handler should be illegal since there's always at least one statement that uses the this pointer (m_isExecuting = false;) after the execution of any handler.


Related issues 1 (0 open1 closed)

Blocks NFD - Task #2589: CI: enable AddressSanitizer for unit testsClosedDavide Pesavento

Actions
Actions

Also available in: Atom PDF