Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Call Stack - nested constructor self calls
Forum Updated to NodeBB v4.3 + New Features

Call Stack - nested constructor self calls

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 3 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aktk
    wrote on last edited by
    #1

    Hi!

    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:

    MainWindow::MainWindow(...):10
    MainWindow::MainWindow(...):20

    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?

    1 Reply Last reply
    0
    • jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Can you share your code?
      Do you instantiate more than one instance of MainWindow?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply
      0
      • jsulmJ jsulm

        Can you share your code?
        Do you instantiate more than one instance of MainWindow?

        A Offline
        A Offline
        aktk
        wrote on last edited by
        #3

        @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.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          aktk
          wrote on last edited by
          #4

          Tried with standard 'Application Example' (tag widget application) - again got nested MainWindow constructors calls.

          kshegunovK 1 Reply Last reply
          0
          • A aktk

            Tried with standard 'Application Example' (tag widget application) - again got nested MainWindow constructors calls.

            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by
            #5

            @aktk
            Hello,
            What you use for IDE and compiler/debuger?
            What are the exact lines you get in your stack trace?

            Kind regards.

            Read and abide by the Qt Code of Conduct

            A 1 Reply Last reply
            0
            • kshegunovK kshegunov

              @aktk
              Hello,
              What you use for IDE and compiler/debuger?
              What are the exact lines you get in your stack trace?

              Kind regards.

              A Offline
              A Offline
              aktk
              wrote on last edited by
              #6

              @kshegunov

              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
              10.10.5 (14F27)

              XCODE
              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

              kshegunovK 1 Reply Last reply
              0
              • A aktk

                @kshegunov

                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
                10.10.5 (14F27)

                XCODE
                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

                kshegunovK Offline
                kshegunovK Offline
                kshegunov
                Moderators
                wrote on last edited by
                #7

                @aktk
                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):
                http://postimg.org/image/4px9szx8b/full/

                Kind regards.

                Read and abide by the Qt Code of Conduct

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  aktk
                  wrote on last edited by
                  #8

                  @kshegunov It is stack window - here is screen of it

                  http://postimg.org/image/6eu8fh10z/

                  kshegunovK 1 Reply Last reply
                  0
                  • A aktk

                    @kshegunov It is stack window - here is screen of it

                    http://postimg.org/image/6eu8fh10z/

                    kshegunovK Offline
                    kshegunovK Offline
                    kshegunov
                    Moderators
                    wrote on last edited by
                    #9

                    @aktk
                    Hello,
                    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?

                    Kind regards.

                    Read and abide by the Qt Code of Conduct

                    A 1 Reply Last reply
                    0
                    • kshegunovK kshegunov

                      @aktk
                      Hello,
                      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?

                      Kind regards.

                      A Offline
                      A Offline
                      aktk
                      wrote on last edited by
                      #10

                      @kshegunov

                      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.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved