From dbe9a8c9696428529cacb9dd4e004db99914b56e Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 12 Apr 2016 16:05:10 +0200 Subject: Don't copy the functor object for each signal emission The behavior was different in the variadic template code and in the C++98 code. The code without variadic template support was not copying the functor object (e.g. a lambda) before calling it. However, in the variadic template section, QtPrivate::FunctorCall::call took the functor by value instead of by reference resulting in a copy. QtPrivate::FunctorCall::call is a helper function for QtPrivate::FunctionPointer::call which is only needed for variadic template expension. [ChangeLog][QtCore][QObject] If the compiler supports variadic templates, no longer copy functor connected to a signal each time the signal is emitted. Restoring the C++98 behavior. Task-number: QTBUG-52542 Change-Id: I3ca20ef6910893b8a288e70af7de4c7b69502173 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qobjectdefs_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/kernel/qobjectdefs_impl.h') diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h index d5574a4dd1..922b6bbb42 100644 --- a/src/corelib/kernel/qobjectdefs_impl.h +++ b/src/corelib/kernel/qobjectdefs_impl.h @@ -491,7 +491,7 @@ namespace QtPrivate { template struct FunctorCall; template struct FunctorCall, List, R, Function> { - static void call(Function f, void **arg) { + static void call(Function &f, void **arg) { f((*reinterpret_cast::Type *>(arg[II+1]))...), ApplyReturnValue(arg[0]); } }; -- cgit v1.2.3