Mac SIGABRT due to segmentation fault
-
I run Qt community version 5.14 on MacOS High Sierra (10.13.6) on a mid 2010 macbook pro 13".
Link to tutorial I used:
https://doc.qt.io/qt-5/qtwidgets-mainwindows-menus-example.htmlI wanted to learn how to use Qt5 recently so i started with a menu bar tutorial. I used very similar code to what was on the tutorial (which is on the official Qt site) and every time I tried to run it the application crashed and gave an error, segmentation fault 11. This is not the first time I have had this problem, and it said the program did a bad access on a presumably reserved memory address. I've looked for answers on the internet other than here, but on all of the websites the solutions do not work or they say it will be fixed in an update.
Anyone know a way to fix this?
Machine specs are at the bottom of the crash reportHere is some of the report (couldn't fit all of it):
Process: projectFirstApp [14055]
Path: /Users/USER/*/projectFirstApp.app/Contents/MacOS/projectFirstApp
Identifier: exampleco.projectFirstApp
Version: 0
Code Type: X86-64 (Native)
Parent Process: Qt Creator [14011]
Responsible: projectFirstApp [14055]
User ID: 501Date/Time: 2020-04-30 14:46:00.277 +0100
OS Version: Mac OS X 10.13.6 (17G11023)
Report Version: 12
Anonymous UUID: 9FB0CA82-93ED-A046-1FDD-57DF6969AF64Sleep/Wake UUID: FCB8934E-B9A3-4C4D-9B75-AD7B923C0889
Time Awake Since Boot: 89000 seconds
Time Since Wake: 12000 secondsSystem Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000040
Exception Note: EXC_CORPSE_NOTIFYTermination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [0]VM Regions Near 0x40:
-->
__TEXT 0000000109109000-0000000109111000 [ 32K] r-x/rwx SM=COW 0 [/Users/tim/build-projectFirstApp-Desktop_Qt_5_12_6_clang_64bit-Debug/projectFirstApp.app/Contents/MacOS/projectFirstApp]Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 org.qt-project.QtCore 0x0000000109fd7204 QObjectPrivate::addConnection(int, QObjectPrivate::Connection*) + 20
1 org.qt-project.QtCore 0x0000000109fe2fcf QObjectPrivate::connectImpl(QObject const*, int, QObject const*, void**, QtPrivate::QSlotObjectBase*, Qt::ConnectionType, int const*, QMetaObject const*) + 687
2 org.qt-project.QtCore 0x0000000109fe2c87 QObject::connectImpl(QObject const*, void**, QObject const*, void**, QtPrivate::QSlotObjectBase*, Qt::ConnectionType, int const*, QMetaObject const*) + 359
3 exampleco.projectFirstApp 0x000000010910f4b5 QMetaObject::Connection QObject::connect<void (QAction::)(bool), void (MainWindow::)()>(QtPrivate::FunctionPointer<void (QAction::)(bool)>::Object const, void (QAction::)(bool), QtPrivate::FunctionPointer<void (MainWindow::)()>::Object const*, void (MainWindow::*)(), Qt::ConnectionType) + 373 (qobject.h:250)
4 exampleco.projectFirstApp 0x000000010910dccb MainWindow::createActions() + 2491 (mainwindow.cpp:120)
5 exampleco.projectFirstApp 0x000000010910d00c MainWindow::MainWindow() + 972 (mainwindow.cpp:24)
6 exampleco.projectFirstApp 0x000000010910f255 MainWindow::MainWindow() + 21 (mainwindow.cpp:33)
7 exampleco.projectFirstApp 0x000000010910cb3b main + 59 (main.cpp:8)
8 libdyld.dylib 0x00007fff5dd71015 start + 1VIRTUAL REGION
REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
Accelerate framework 128K 2
Activity Tracing 256K 2
CG backing stores 224K 3
CoreImage 8K 3
CoreServices 12K 2
CoreUI image file 280K 4
Dispatch continuations 4096K 2
Kernel Alloc Once 8K 2
MALLOC 41.3M 25
MALLOC guard page 32K 6
OpenGL GLSL 256K 4
STACK GUARD 56.0M 6
Stack 10.0M 6
VM_ALLOCATE 52K 6
__DATA 41.8M 245
__FONT_DATA 4K 2
__GLSLBUILTINS 2588K 2
__LINKEDIT 196.5M 12
__TEXT 176.0M 244
__UNICODE 560K 2
mapped file 51.9M 15
shared memory 644K 10
=========== ======= =======
TOTAL 582.5M 583Model: MacBookPro7,1, BootROM 68.0.0.0.0, 2 processors, Intel Core 2 Duo, 2.66 GHz, 10 GB, SMC 1.62f7
Graphics: NVIDIA GeForce 320M, NVIDIA GeForce 320M
Memory Module: BANK 0/DIMM0, 8 GB, DDR3, 1067 MHz, 0x80CE, 0x4D34373142314737334542302D594B302020
Memory Module: BANK 1/DIMM0, 2 GB, DDR3, 1067 MHz, 0x80AD, 0x484D54313235533654465238432D47372020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x8D), Broadcom BCM43xx 1.0 (5.106.98.102.30)
Bluetooth: Version 6.0.7f17, 3 services, 27 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en1
Serial ATA Device: TOSHIBA MK5055GSXF, 500.11 GB
Serial ATA Device: MATSHITADVD-R UJ-898
USB Device: USB Bus
USB Device: BRCM2046 Hub
USB Device: Bluetooth USB Host Controller
USB Device: IR Receiver
USB Device: Apple Internal Keyboard / Trackpad
USB Device: USB Bus
USB Device: USB 2.0 Bus
USB Device: Internal Memory Card Reader
USB Device: USB 2.0 Bus
USB Device: Built-in iSight
USB Device: USB2.0 Hub
USB Device: USB Receiver
USB Device: Dell USB Keyboard
Thunderbolt Bus: -
Hi and welcome to devnet,
How did you install Qt ?
How different is your code from the example ?
Does the example also crash for your ? -
I installed Qt community directly from the website, and the code on the example is pretty much identical to the example, although some of the names are different and I included another file. I also didn't include all of the code they added (it still compiled fine) and the example still gives and error when I run it.
-
Which release of 5.14 ? There have been several.
-
Then you might want to test the latest release before going deeper.
-
I've tested the latest release and experimented with it on a new project, I've found that bad accesses (at least in my case) are caused by referencing uninitialised pointers. This does not show as an error when linking or compiling. I made sure to check that all pointers were initialised and the code ran fine. Thanks for the help!
-
It's your responsibility to initialize your pointers not the compiler and even less the linker.