Call Stack - nested constructor self calls
I've got trouble with Qt5.4.1 - in my Desktop application on Mac I have double constructors calls in call stack.
In general I put a breakpoint in the very first line of MainWindow class constructor and in debug see in call stack something like this:
Like constructor calls him self after he finished first time - if I try to navigate to first call stack item - I got on last braсket - like second constructor call appears automatically after first one.
Any ideas why it could be so?
Can you share your code?
Do you instantiate more than one instance of MainWindow?
@jsulm I've tried it with standard example app (smth like doc view example) - just to remove my own code issues - it also shows double constructor call in stack.
Tried with standard 'Application Example' (tag widget application) - again got nested MainWindow constructors calls.
What you use for IDE and compiler/debuger?
What are the exact lines you get in your stack trace?
Qt Creator 3.6.0
Based on Qt 5.5.1 (Clang 6.1 (Apple), 64 bit)
Built on Dec 15 2015 01:02:29
From revision b52c2f91f5
OS X Yosemite
Version 6.4 (6E35b)
Stack trace for standard Application Example:
1 MainWindow::MainWindow() mainwindow.cpp 51 0x100003503
2 MainWindow::MainWindow() mainwindow.cpp 66 0x100005835
3 main main.cpp 53 0x100003088
4 start 0x100002fd4
I believe you're looking at the wrong window. What you've put looks more like the breakpoints window and not the stack trace. If that's the case it's perfectly normal to have multiple entries for a single function. Take a look at what my QtCreator reports (left is stack, right is breakpoints):
This is strange indeed. From what I can tell, these are two different constructors (note the line numbers). I've never seen this before, maybe it's something specific to your debugger?
I've tried several compiler/debuggers/qt creator combinations - at the moment I have Xcode 5.0 and Qt Creator 3.3 - they still have double constructor call issue.
lldb and g++ from Xcode selected in kit - and they also have this issue.