signals icon indicating copy to clipboard operation
signals copied to clipboard

Memory leak when the signal is destroyed before the fteng::connection is destroyed

Open Philippe91 opened this issue 3 years ago • 1 comments

If the signal is destroyed after the connected functor, then there is a leak.

Example:

	std::function<void()> stdFunction = [] {};

	auto* testSignal = new fteng::signal<void()>;
	fteng::connection connection = testSignal->connect(std::move(stdFunction));

	delete testSignal;

The leaked object is 'f_type' allocated from the line:

new (&call.object) unique{ new f_type(std::move(functor)) };

inside connect(F&& functor)

Philippe91 avatar May 05 '21 16:05 Philippe91

Does #22 fix your problem?

mikezackles avatar May 31 '21 14:05 mikezackles