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. Application crashes while accessing Pointers and while Hovering over custom QGraphicsItems

Application crashes while accessing Pointers and while Hovering over custom QGraphicsItems

Scheduled Pinned Locked Moved Unsolved General and Desktop
pointerc++segfaultqgraphicsitem
14 Posts 3 Posters 3.7k Views
  • 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.
  • L Lanparty
    17 Apr 2019, 16:55

    Hi there! Thank you so much.

    The crash currently happens when I start the application (i think due to ellipse1->checkPointers();) or when I hover over one of the circles with my cursor.

    M Offline
    M Offline
    mrjj
    Lifetime Qt Champion
    wrote on 17 Apr 2019, 16:58 last edited by
    #4

    @Lanparty
    Hi
    So if you put break point at
    void Slice::hoverEnterEvent(QGraphicsSceneHoverEvent *)
    and single step over the code.
    Can you then pinpoint which line it does crash in?

    L 1 Reply Last reply 17 Apr 2019, 17:16
    1
    • M mrjj
      17 Apr 2019, 16:58

      @Lanparty
      Hi
      So if you put break point at
      void Slice::hoverEnterEvent(QGraphicsSceneHoverEvent *)
      and single step over the code.
      Can you then pinpoint which line it does crash in?

      L Offline
      L Offline
      Lanparty
      wrote on 17 Apr 2019, 17:16 last edited by Lanparty
      #5

      @mrjj Hey, if i put the breakpoint where you implied it does not even get to the breakpoint and I only get the segfault (see above in screenshot) again.

      Even after commenting // ellipse1->checkPointers(); out it still behaves the same way while debugging.

      However when starting the application it starts now without crashing immediately (after taking out / ellipse1->checkPointers();), it only crashes once I hover over the objects.

      But I'll try to find the position where it crashes and I'll update this message or post another reply once I know.

      M 1 Reply Last reply 17 Apr 2019, 17:26
      0
      • L Lanparty
        17 Apr 2019, 17:16

        @mrjj Hey, if i put the breakpoint where you implied it does not even get to the breakpoint and I only get the segfault (see above in screenshot) again.

        Even after commenting // ellipse1->checkPointers(); out it still behaves the same way while debugging.

        However when starting the application it starts now without crashing immediately (after taking out / ellipse1->checkPointers();), it only crashes once I hover over the objects.

        But I'll try to find the position where it crashes and I'll update this message or post another reply once I know.

        M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 17 Apr 2019, 17:26 last edited by
        #6

        @Lanparty
        Ok so its before hoverEnterEvent. thats odd.
        Also, there really is nothing of your code in call stack ?

        L 1 Reply Last reply 19 Apr 2019, 15:14
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 17 Apr 2019, 20:27 last edited by
          #7

          Hi,

          The stack trace you posted seems to be from a release build. Can you share the stack trace from your debug build ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2
          • M mrjj
            17 Apr 2019, 17:26

            @Lanparty
            Ok so its before hoverEnterEvent. thats odd.
            Also, there really is nothing of your code in call stack ?

            L Offline
            L Offline
            Lanparty
            wrote on 19 Apr 2019, 15:14 last edited by
            #8

            @mrjj @SGaist

            Hi! Thanks again for your replies and your interest in my current problem.
            I'm not quite sure if I did this the correct way, but I think I figured out how to get what you asked and I hope that this information is what you've been looking for.

            This should be the call stack from my debug build (at least I hope it is :'D):

            1  ntdll!RtlGetCurrentServiceSessionId                                                   0x77ae4cd9 
            2  ??                                                                                    0xb80afd3f 
            3  ??                                                                                    0x1ef069b0 
            4  ntdll!RtlFreeHeap                                                                     0x77ae3812 
            5  ntdll!RtlpNtSetValueKey                                                               0x77b82ea1 
            6  ntdll!RtlGetCurrentServiceSessionId                                                   0x77ae3c45 
            7  ??                                                                                    0x1ef069b8 
            8  ntdll!RtlFreeHeap                                                                     0x77ae3812 
            9  msvcrt!free                                                                           0x76a070b5 
            10 ??                                                                                    0x1f0000   
            11 QWindowsFontDatabase::releaseHandle                     qwindowsfontdatabase.cpp 1601 0x62a928b6 
            12 QtFontStyle::~QtFontStyle                               qfontdatabase.cpp        234  0x1372329  
            13 QtFontFoundry::~QtFontFoundry                           qfontdatabase.cpp        303  0x138530c  
            14 QtFontFamily::~QtFontFamily                             qfontdatabase.cpp        365  0x1375138  
            15 QFontDatabasePrivate::free                              qfontdatabase.cpp        482  0x13a8915  
            16 QFontDatabasePrivate::~QFontDatabasePrivate             qfontdatabase.cpp        470  0x13a89af  
            17 (anonymous namespace)::Q_QGS_privateDb::Holder::~Holder qfontdatabase.cpp        720  0x1121bed  
            18 __tcf_0                                                 qfontdatabase.cpp        720  0x1121c0a  
            19 _CRT_INIT *12                                                                         0x10511b4  
            20 __DllMainCRTStartup                                                                   0x1051325  
            21 DllMainCRTStartup *12                                                                 0x1051433  
            22 ntdll!RtlCheckTokenCapability                                                         0x77b0a896 
            23 ntdll!RtlHashUnicodeString                                                            0x77ae01a6 
            24 ntdll!LdrShutdownProcess                                                              0x77ad458d 
            25 ??                                                                                               
            
            

            I hope this helps. Enjoy your weekend and thanks again!

            M 1 Reply Last reply 19 Apr 2019, 18:49
            0
            • L Lanparty
              19 Apr 2019, 15:14

              @mrjj @SGaist

              Hi! Thanks again for your replies and your interest in my current problem.
              I'm not quite sure if I did this the correct way, but I think I figured out how to get what you asked and I hope that this information is what you've been looking for.

              This should be the call stack from my debug build (at least I hope it is :'D):

              1  ntdll!RtlGetCurrentServiceSessionId                                                   0x77ae4cd9 
              2  ??                                                                                    0xb80afd3f 
              3  ??                                                                                    0x1ef069b0 
              4  ntdll!RtlFreeHeap                                                                     0x77ae3812 
              5  ntdll!RtlpNtSetValueKey                                                               0x77b82ea1 
              6  ntdll!RtlGetCurrentServiceSessionId                                                   0x77ae3c45 
              7  ??                                                                                    0x1ef069b8 
              8  ntdll!RtlFreeHeap                                                                     0x77ae3812 
              9  msvcrt!free                                                                           0x76a070b5 
              10 ??                                                                                    0x1f0000   
              11 QWindowsFontDatabase::releaseHandle                     qwindowsfontdatabase.cpp 1601 0x62a928b6 
              12 QtFontStyle::~QtFontStyle                               qfontdatabase.cpp        234  0x1372329  
              13 QtFontFoundry::~QtFontFoundry                           qfontdatabase.cpp        303  0x138530c  
              14 QtFontFamily::~QtFontFamily                             qfontdatabase.cpp        365  0x1375138  
              15 QFontDatabasePrivate::free                              qfontdatabase.cpp        482  0x13a8915  
              16 QFontDatabasePrivate::~QFontDatabasePrivate             qfontdatabase.cpp        470  0x13a89af  
              17 (anonymous namespace)::Q_QGS_privateDb::Holder::~Holder qfontdatabase.cpp        720  0x1121bed  
              18 __tcf_0                                                 qfontdatabase.cpp        720  0x1121c0a  
              19 _CRT_INIT *12                                                                         0x10511b4  
              20 __DllMainCRTStartup                                                                   0x1051325  
              21 DllMainCRTStartup *12                                                                 0x1051433  
              22 ntdll!RtlCheckTokenCapability                                                         0x77b0a896 
              23 ntdll!RtlHashUnicodeString                                                            0x77ae01a6 
              24 ntdll!LdrShutdownProcess                                                              0x77ad458d 
              25 ??                                                                                               
              
              

              I hope this helps. Enjoy your weekend and thanks again!

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 19 Apr 2019, 18:49 last edited by
              #9

              @Lanparty
              Hi
              Super.
              Is that from when it crashes ?

              L 1 Reply Last reply 20 Apr 2019, 10:02
              0
              • M mrjj
                19 Apr 2019, 18:49

                @Lanparty
                Hi
                Super.
                Is that from when it crashes ?

                L Offline
                L Offline
                Lanparty
                wrote on 20 Apr 2019, 10:02 last edited by Lanparty
                #10

                @mrjj yeah, well I ran the debugger and this is what happened afterwards (including the application crashing)

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  Lanparty
                  wrote on 26 Apr 2019, 13:11 last edited by
                  #11

                  @Lanparty said in Application crashes while accessing Pointers and while Hovering over custom QGraphicsItems:

                  void Slice::hoverEnterEvent(QGraphicsSceneHoverEvent *)
                  {
                      if (text.isNull())
                          return;
                  
                      QString percentageAsString = QString::number(int(this->getPercentage()));
                  
                      text.data()->setPlainText(this->category + " " + percentageAsString + "% ");
                  
                      int xOffset = int(rect().x() + rect().width()/2);
                      int yOffset = int(rect().y() + rect().height()/2);
                  
                      QPointF newCenterPoint = QPointF(this->pos().x()+ xOffset, this->pos().y() + yOffset);
                      QPointF textPoint = newCenterPoint;
                  
                      textPoint.setX(this->x() + 100);
                  
                      text.data()->setPos(textPoint);
                  
                      text.data()->setVisible(true);
                  }
                  

                  so, I actually managed to find out where my application crashed. The problem was this line:

                   text.data()->setPlainText(this->category + " " + percentageAsString + "% ");
                  

                  once I checked the expected parameters it kind of made sense. I'll try to find another way to achieve the string I originally wanted to be displayed.

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 26 Apr 2019, 20:36 last edited by
                    #12

                    Do you mean you were missing the text.isNull() check ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    L 1 Reply Last reply 28 Apr 2019, 11:03
                    0
                    • S SGaist
                      26 Apr 2019, 20:36

                      Do you mean you were missing the text.isNull() check ?

                      L Offline
                      L Offline
                      Lanparty
                      wrote on 28 Apr 2019, 11:03 last edited by Lanparty
                      #13

                      @SGaist No, that's the first thing I did inside the method. However, I simply assumed that I could use the method setPlainText() as I pleased, but it was expecting other arguments and crashed instead (I guess because the QString text would've been longer than the original one.

                      btw: how do I change the status of my post to "solved"?

                      M 1 Reply Last reply 28 Apr 2019, 11:13
                      0
                      • L Lanparty
                        28 Apr 2019, 11:03

                        @SGaist No, that's the first thing I did inside the method. However, I simply assumed that I could use the method setPlainText() as I pleased, but it was expecting other arguments and crashed instead (I guess because the QString text would've been longer than the original one.

                        btw: how do I change the status of my post to "solved"?

                        M Offline
                        M Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on 28 Apr 2019, 11:13 last edited by
                        #14

                        @Lanparty said in Application crashes while accessing Pointers and while Hovering over custom QGraphicsItems:

                        btw: how do I change the status of my post to "solved"?

                        First post, Topic Tools button to the side.

                        1 Reply Last reply
                        0

                        13/14

                        28 Apr 2019, 11:03

                        • Login

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