Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Romain-Donze opened this issue Jun 30, 2022 · 0 comments

Comments

@Romain-Donze
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant