using nullptr for QSemaphore instead of a different call

This commit is contained in:
Uwe Rathmann 2024-01-29 12:21:46 +01:00
parent e058886fcb
commit 7ab5c50b3d
2 changed files with 10 additions and 14 deletions

View File

@ -7,9 +7,7 @@
#include <qcoreapplication.h> #include <qcoreapplication.h>
#include <qobject.h> #include <qobject.h>
#if QT_CONFIG(thread)
#include <qsemaphore.h> #include <qsemaphore.h>
#endif
#include <qthread.h> #include <qthread.h>
QSK_QT_PRIVATE_BEGIN QSK_QT_PRIVATE_BEGIN
@ -190,8 +188,6 @@ void QskMetaFunction::invoke( QObject* object,
? Qt::QueuedConnection : Qt::DirectConnection; ? Qt::QueuedConnection : Qt::DirectConnection;
} }
const auto argc = parameterCount() + 1; // return value + arguments
switch ( invokeType ) switch ( invokeType )
{ {
case Qt::DirectConnection: case Qt::DirectConnection:
@ -215,7 +211,7 @@ void QskMetaFunction::invoke( QObject* object,
m_functionCall, nullptr, 0, argv, &semaphore ); m_functionCall, nullptr, 0, argv, &semaphore );
#else #else
auto event = new QMetaCallEvent( auto event = new QMetaCallEvent(
m_functionCall, nullptr, 0, argc ); m_functionCall, nullptr, 0, argv, nullptr );
#endif #endif
QCoreApplication::postEvent( receiver, event ); QCoreApplication::postEvent( receiver, event );
@ -231,6 +227,8 @@ void QskMetaFunction::invoke( QObject* object,
if ( receiver.isNull() ) if ( receiver.isNull() )
return; return;
const auto argc = parameterCount() + 1; // return value + arguments
auto event = new QMetaCallEvent( m_functionCall, nullptr, 0, argc ); auto event = new QMetaCallEvent( m_functionCall, nullptr, 0, argc );
auto types = event->types(); auto types = event->types();

View File

@ -9,9 +9,7 @@
#include <qmetaobject.h> #include <qmetaobject.h>
#include <qobject.h> #include <qobject.h>
#include <qcoreapplication.h> #include <qcoreapplication.h>
#if QT_CONFIG(thread)
#include <qsemaphore.h> #include <qsemaphore.h>
#endif
#include <qthread.h> #include <qthread.h>
QSK_QT_PRIVATE_BEGIN QSK_QT_PRIVATE_BEGIN
@ -165,12 +163,6 @@ static void qskInvokeMetaCall(
? Qt::QueuedConnection : Qt::DirectConnection; ? Qt::QueuedConnection : Qt::DirectConnection;
} }
#if 1
// should be doable without QMetaMethod. TODO ...
const auto method = metaObject->method( offset + index );
#endif
const int argc = method.parameterCount() + 1;
switch ( invokeType ) switch ( invokeType )
{ {
case Qt::DirectConnection: case Qt::DirectConnection:
@ -208,7 +200,7 @@ static void qskInvokeMetaCall(
#else #else
auto event = new MetaCallEvent( call, metaObject, auto event = new MetaCallEvent( call, metaObject,
offset, index, argc ); offset, index, args, nullptr );
#endif #endif
QCoreApplication::postEvent( receiver, event ); QCoreApplication::postEvent( receiver, event );
@ -228,6 +220,12 @@ static void qskInvokeMetaCall(
if ( call == QMetaObject::InvokeMetaMethod ) if ( call == QMetaObject::InvokeMetaMethod )
{ {
#if 1
// should be doable without QMetaMethod. TODO ...
const auto method = metaObject->method( offset + index );
#endif
const int argc = method.parameterCount() + 1;
event = new MetaCallEvent( call, metaObject, offset, index, argc ); event = new MetaCallEvent( call, metaObject, offset, index, argc );
/* /*