summaryrefslogtreecommitdiffstats
path: root/src/gui/doc/snippets/polygon/polygon.cpp
diff options
context:
space:
mode:
authorAurélien Brooke <[email protected]>2025-05-23 20:19:43 +0200
committerAurélien Brooke <[email protected]>2025-07-11 20:44:23 +0200
commitf6211c079fa000c0d46b7912341f014669fa628a (patch)
tree84fb4988d0e03d76edded4b6f1068d8e017b5985 /src/gui/doc/snippets/polygon/polygon.cpp
parent54204fc7943ef91aa9b665b1287b870680697db4 (diff)
QMetaCallEvent: avoid heap allocations for small argumentsHEADdev
Previously, all arguments for queued connections were heap-allocated via QMetaType::create(), even for small types like int or QObject*. This incurred many micro-allocations and led to inefficient cross-thread memory ownership. Additionally, argument copying was the responsibility of the caller after constructing the QMetaCallEvent, leading to code duplication and potential misuse. To fix this, this patch introduces QQueuedMetaCallEvent as a specialized subclass of QMetaCallEvent, used exclusively for queued signal-slot delivery. It supports in-place argument storage by preallocating space for up to 3 argument values (plus 5 pointers and types), enabling copy- construction directly within the event object for types that fit within a 3 × sizeof(void*) buffer and are suitably aligned. Heap allocation via QMetaType::create() is still used as a fallback for larger types. Legacy QMetaCallEvent constructors and the args() and types() accessors are marked deprecated and will be removed once the corresponding qtdeclarative patch eliminates their usage. The prealloc_ member, currently shared for transitional reasons, will also be moved into QQueuedMetaCallEvent as part of that cleanup. Amends b7d073e9905bf9812ba96cecdcf6871a95517d30. Change-Id: Icb6c1544de193b3fe6311fe76eaf00cf501d8977 Reviewed-by: Thiago Macieira <[email protected]>
Diffstat (limited to 'src/gui/doc/snippets/polygon/polygon.cpp')
0 files changed, 0 insertions, 0 deletions