error on exiting Steca
After compiling libqcr and Steca in debug mode, and running gdb ctest
, then run -R run5 --output-on-failure
, the following output appears:
=================================================================
==132238==ERROR: AddressSanitizer: new-delete-type-mismatch on 0x61f000000e80 in thread T0:
object passed to delete has wrong type:
size of the allocated type: 3400 bytes;
size of the deallocated type: 136 bytes.
#0 0x7ffff78ba3c8 in operator delete(void*, unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:164
#1 0x7ffff70c5b96 in QcrTrigger::~QcrTrigger() /usr/local/include/QCR/widgets/actions.h:38
#2 0x7ffff53642d6 in QObjectPrivate::deleteChildren() (/lib/x86_64-linux-gnu/libQt6Core.so.6+0x1642d6)
#3 0x7ffff53670e7 in QObject::~QObject() (/lib/x86_64-linux-gnu/libQt6Core.so.6+0x1670e7)
#4 0x555555572c18 in main /G/sw/steca/main/steca.cpp:140
#5 0x7ffff5046189 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
#6 0x7ffff5046244 in __libc_start_main_impl ../csu/libc-start.c:381
#7 0x555555570790 in _start (/G/sw/steca/debug/bin/steca+0x1c790)
0x61f000000e80 is located 0 bytes inside of 3400-byte region [0x61f000000e80,0x61f000001bc8)
allocated by thread T0 here:
#0 0x7ffff78b94c8 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:95
#1 0x7ffff714d177 in MainWin::MainWin(QString const&) /G/sw/steca/gui/mainwin.cpp:51
#2 0x555555572bd3 in main /G/sw/steca/main/steca.cpp:136
#3 0x7ffff5046189 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
SUMMARY: AddressSanitizer: new-delete-type-mismatch ../../../../src/libsanitizer/asan/asan_new_delete.cpp:164 in operator delete(void*, unsigned long)
==132238==HINT: if you don't care about these errors you may set ASAN_OPTIONS=new_delete_type_mismatch=0
==132238==ABORTING
CMake Error at /G/sw/steca/ftest/RunTest.cmake:41 (message):
Steca=/G/sw/steca/debug/bin/steca test_exe=/G/sw/steca/debug/ftest/run5.cmd
terminated with error: 1
Line steca.cpp:140 refers to the end of the block in the following modfied code:
int ret;
{
QApplication app(argc, argv);
app.setApplicationName(APPLICATION_NAME);
app.setApplicationVersion(VERSION);
app.setOrganizationName(ORGANIZATION_NAME);
app.setOrganizationDomain(ORGANIZATION_DOMAIN);
#if defined(Q_OS_OSX)
app.setStyle(QStyleFactory::create("Macintosh"));
#elif defined(Q_OS_WIN)
app.setStyle(QStyleFactory::create("Fusion"));
#else
app.setStyle(QStyleFactory::create("Fusion"));
#endif
qInstallMessageHandler(qcr::messageHandler);
if (threads != -1)
QThreadPool::globalInstance()->setMaxThreadCount(threads);
new MainWin{startupScript};
ret = app.exec();
}
So the error happens on destruction of app
.