Skip to content

warning: Called C++ object pointer is null [clang-analyzer-core.CallAndMessage] #6

@Romain-Donze

Description

@Romain-Donze

So in my project I am getting some weird crashes and I am suspecting it being a problem with QDeferred.

When running Clang-Tidy and Clazy analyzer in QtCreator, I am getting some warning with "C++ object pointer is null" message.

I went and tested with test13 and got the same warning message

warning: Called C++ object pointer is null [clang-analyzer-core.CallAndMessage]
1: Calling 'QDeferred::resolve' in /home/inno-dev/Bureau/TMP/QDeferred/tests/test13/awaitwidget.h:34
2: Called C++ object pointer is null in /home/inno-dev/Bureau/TMP/QDeferred/src/qdeferred.hpp:312

I also got this one

warning: Use of memory after it is freed [clang-analyzer-cplusplus.NewDelete]
1: Calling default constructor for 'QDeferred<>' in /home/inno-dev/Bureau/TMP/QDeferred/src/qlambdathreadworkerdata.cpp:159
2: Memory is allocated in /home/inno-dev/Bureau/TMP/QDeferred/src/qdeferred.hpp:146
3: Returning from default constructor for 'QDeferred<>' in /home/inno-dev/Bureau/TMP/QDeferred/src/qlambdathreadworkerdata.cpp:159
4: Assuming the condition is true in /home/inno-dev/Bureau/TMP/QDeferred/src/qlambdathreadworkerdata.cpp:160
5: Left side of '||' is true in /home/inno-dev/Bureau/TMP/QDeferred/src/qlambdathreadworkerdata.cpp:160
6: Calling 'QDeferred::reject' in /home/inno-dev/Bureau/TMP/QDeferred/src/qlambdathreadworkerdata.cpp:162
7: Calling copy constructor for 'QDeferred<>' in /home/inno-dev/Bureau/TMP/QDeferred/src/qdeferred.hpp:319
8: Calling 'QExplicitlySharedDataPointer::reset' in /home/inno-dev/Bureau/TMP/QDeferred/src/qdeferred.hpp:152
9: Field 'd' is non-null in /opt/Qt/5.15.8/gcc_64/include/QtCore/qshareddata.h:170
10: Left side of '&&' is true in /opt/Qt/5.15.8/gcc_64/include/QtCore/qshareddata.h:170
11: Assuming the condition is true in /opt/Qt/5.15.8/gcc_64/include/QtCore/qshareddata.h:170
12: Taking true branch in /opt/Qt/5.15.8/gcc_64/include/QtCore/qshareddata.h:170
13: Memory is released in /opt/Qt/5.15.8/gcc_64/include/QtCore/qshareddata.h:171
14: Returning; memory was released in /home/inno-dev/Bureau/TMP/QDeferred/src/qdeferred.hpp:152
15: Returning from copy constructor for 'QDeferred<>' in /home/inno-dev/Bureau/TMP/QDeferred/src/qdeferred.hpp:319
16: Use of memory after it is freed in /home/inno-dev/Bureau/TMP/QDeferred/src/qdeferred.hpp:319

Is that a normal case? Maybe this us just because clang doesn't work well with QExplicitlySharedDataPointer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions