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. Access violation QRubberBand
Qt 6.11 is out! See what's new in the release blog

Access violation QRubberBand

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 663 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by Perdrix
    #1

    This code:

    void DSSImageView::mousePressEvent(QMouseEvent* e)
    {
        rubberBandOrigin = e->pos();
        if (!rubberBand)
            rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
        rubberBand->setGeometry(QRect(rubberBandOrigin, QSize()));
        rubberBand->show();
        emit Image_mousePressEvent(e);
    }
    

    ends up with an access violation with a this->data value of 0xfdfdfdfd00000147 attempting to execute the following code in qwidget.h at line 768

    inline Qt::WindowType QWidget::windowType() const
    { return static_cast<Qt::WindowType>(int(data->window_flags & Qt::WindowType_Mask)); }
    

    9f8d060f-d913-4460-8f6d-bb86027a5067-image.png

    JonBJ 1 Reply Last reply
    0
    • mranger90M Offline
      mranger90M Offline
      mranger90
      wrote on last edited by
      #3

      Are you sure that rubberBand has been initialized as nullptr ?

      PerdrixP 1 Reply Last reply
      2
      • PerdrixP Perdrix

        This code:

        void DSSImageView::mousePressEvent(QMouseEvent* e)
        {
            rubberBandOrigin = e->pos();
            if (!rubberBand)
                rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
            rubberBand->setGeometry(QRect(rubberBandOrigin, QSize()));
            rubberBand->show();
            emit Image_mousePressEvent(e);
        }
        

        ends up with an access violation with a this->data value of 0xfdfdfdfd00000147 attempting to execute the following code in qwidget.h at line 768

        inline Qt::WindowType QWidget::windowType() const
        { return static_cast<Qt::WindowType>(int(data->window_flags & Qt::WindowType_Mask)); }
        

        9f8d060f-d913-4460-8f6d-bb86027a5067-image.png

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #2

        @Perdrix
        Dunno, you sure your rubberBand stays around, e.g. hasn't been deleted? Most likely would be an existing rubberBand pointing to rubbish or deleted widget? Also, assuming no threads, this will execute Image_mousePressEvent(e) directly, maybe that has a problem?

        In any case, it may not solve, but what you should show here is the stack trace during debug (it's in one of the debugger windows) at the time of the access violation, depending on content that might help narrow down. It may go all the way back to a particular line in your code.

        1 Reply Last reply
        1
        • mranger90M Offline
          mranger90M Offline
          mranger90
          wrote on last edited by
          #3

          Are you sure that rubberBand has been initialized as nullptr ?

          PerdrixP 1 Reply Last reply
          2
          • mranger90M mranger90

            Are you sure that rubberBand has been initialized as nullptr ?

            PerdrixP Offline
            PerdrixP Offline
            Perdrix
            wrote on last edited by Perdrix
            #4

            @mranger90 BLUSH! That's so stupid of me! DOH! Slap-head award coming my way!

            David

            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