making -fanalyzer happy

This commit is contained in:
Uwe Rathmann 2020-05-09 16:17:27 +02:00
parent cb43ac7dee
commit 3f416c21f9
2 changed files with 16 additions and 6 deletions

View File

@ -120,6 +120,8 @@ pedantic {
QMAKE_CXXFLAGS *= -Wsuggest-override
# QMAKE_CXXFLAGS *= -Wsuggest-final-types
# QMAKE_CXXFLAGS *= -Wsuggest-final-methods
# QMAKE_CXXFLAGS *= -fanalyzer
}
linux-clang {

View File

@ -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;
}