Segmentation fault when allocating widgets
I've hit a rather bizarre (and frustrating) issue involving the setupUi() method generated by Qt Creator:
void setupUi(QMainWindow *MainWindow)
actionFull_Screen = new QAction(MainWindow);
actionClose_Midi = new QAction(MainWindow);
The issue is that once the method attempts to allocate any widget (not just a QAction), a segfault occurs. It can't be that MainWindow is a null pointer, since it always points to the (already instantiated) main window, and the same pointer is dereferenced several times without any problems immediately prior to the segfault anyway.
What's especially strange about this is that the problem more or less came out of nowhere; before it started happening, I had only made minimal changes to the .ui file, which basically amounted to tweaking a few widget settings, but nothing that seems like it would lead to an issue like this.
Any ideas? (If it makes a difference, I'm running Qt Creator 2.4.0 on Windows)
Thanks in advance!
As the very first step, I would try to completely rebuild the project.
Hmm, that did the trick - no idea why I didn't try that previously. Thanks!
No problem, you're welcome. Sometimes the source code of some class using another one is not recompiled in case the latter one changes. So, the object alignment within that latter class doesn't fit that of the using class anymore. I ran into some weird crashes of that sort quite often too, most times a recompile cures everything.
Be sure and tag your post as [Solved]. Thanks!