diff --git a/features/qskconfig.pri b/features/qskconfig.pri index 8f08767a..994b322d 100644 --- a/features/qskconfig.pri +++ b/features/qskconfig.pri @@ -120,6 +120,8 @@ pedantic { QMAKE_CXXFLAGS *= -Wsuggest-override # QMAKE_CXXFLAGS *= -Wsuggest-final-types # QMAKE_CXXFLAGS *= -Wsuggest-final-methods + + # QMAKE_CXXFLAGS *= -fanalyzer } linux-clang { diff --git a/src/common/QskMetaFunction.cpp b/src/common/QskMetaFunction.cpp index 9ee739f6..678542d7 100644 --- a/src/common/QskMetaFunction.cpp +++ b/src/common/QskMetaFunction.cpp @@ -200,11 +200,11 @@ void QskMetaFunction::invoke( QObject* object, // code is not thread safe - TODO ... - QPointer< QObject > receiver( object ); - if ( m_functionCall == nullptr ) return; + QPointer< QObject > receiver( object ); + int invokeType = connectionType & 0x3; if ( invokeType == Qt::AutoConnection ) @@ -247,8 +247,16 @@ void QskMetaFunction::invoke( QObject* object, const auto argc = parameterCount() + 1; // return value + arguments - auto types = static_cast< int* >( malloc( argc * sizeof( int ) ) ); - auto arguments = static_cast< void** >( malloc( argc * sizeof( void* ) ) ); + auto types = static_cast< int* >( std::malloc( argc * sizeof( int ) ) ); + auto arguments = static_cast< void** >( std::malloc( argc * sizeof( void* ) ) ); + + if ( types == nullptr || arguments == nullptr ) + { + std::free( types ); + std::free( arguments ); + + return; + } types[ 0 ] = QMetaType::UnknownType; arguments[ 0 ] = nullptr; @@ -270,8 +278,8 @@ void QskMetaFunction::invoke( QObject* object, if ( receiver.isNull() ) { // object might have died in the meantime - free( types ); - free( arguments ); + std::free( types ); + std::free( arguments ); return; }