VirtualBox

Changeset 29542 in vbox


Ignore:
Timestamp:
May 17, 2010 1:41:20 PM (15 years ago)
Author:
vboxsync
Message:

Main: better handle null shapes

Location:
trunk/src/VBox
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp

    r29518 r29542  
    107107        com::SafeArray <BYTE> aShape(ComSafeArrayInArg (pShape));
    108108        size_t cbShapeSize = aShape.size();
    109         shape.resize(cbShapeSize);
    110         ::memcpy(shape.raw(), aShape.raw(), cbShapeSize);
     109        if (cbShapeSize > 0)
     110        {
     111            shape.resize(cbShapeSize);
     112            ::memcpy(shape.raw(), aShape.raw(), cbShapeSize);
     113        }
    111114    }
    112115
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp

    r29518 r29542  
    216216        com::SafeArray <BYTE> aShape(ComSafeArrayInArg (pShape));
    217217        size_t cbShapeSize = aShape.size();
    218         shape.resize(cbShapeSize);
    219         ::memcpy(shape.raw(), aShape.raw(), cbShapeSize);
     218        if (cbShapeSize > 0)
     219        {
     220            shape.resize(cbShapeSize);
     221            ::memcpy(shape.raw(), aShape.raw(), cbShapeSize);
     222        }
    220223    }
    221224    ~MousePointerChangeEvent()
     
    228231    uint width() const { return w; }
    229232    uint height() const { return h; }
    230     const uchar *shapeData() const { return shape.raw(); }
     233    const uchar *shapeData() const { return shape.size() > 0 ? shape.raw() : NULL; }
    231234private:
    232235    bool vis, alph;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r29518 r29542  
    6060    {
    6161        com::SafeArray <BYTE> aShape(ComSafeArrayInArg (pShape));
    62         size_t cbShapeSize = aShape.size();
    63         m_shape.resize(cbShapeSize);
    64         ::memcpy(m_shape.raw(), aShape.raw(), cbShapeSize);
     62        size_t cbShapeSize = aShape.size();       
     63        if (cbShapeSize > 0)
     64        {
     65            m_shape.resize(cbShapeSize);
     66            ::memcpy(m_shape.raw(), aShape.raw(), cbShapeSize);
     67        }
    6568    }
    6669
     
    7578    uint width() const { return m_uWidth; }
    7679    uint height() const { return m_uHeight; }
    77     const uchar *shapeData() const { return m_shape.raw(); }
     80    const uchar *shapeData() const { return m_shape.size() > 0 ? m_shape.raw() : NULL; }
    7881
    7982private:
  • trunk/src/VBox/Main/DisplayImpl.cpp

    r29518 r29542  
    38293829    Display *pThis = pDrv->pDisplay;
    38303830
    3831     size_t cbShapeSize = (cx + 7) / 8 * cy; /* size of the AND mask */
    3832     cbShapeSize = ((cbShapeSize + 3) & ~3) + cx * 4 * cy; /* + gap + size of the XOR mask */
     3831    size_t cbShapeSize = 0;
     3832
     3833    if (pvShape)
     3834    {
     3835        cbShapeSize = (cx + 7) / 8 * cy; /* size of the AND mask */
     3836        cbShapeSize = ((cbShapeSize + 3) & ~3) + cx * 4 * cy; /* + gap + size of the XOR mask */
     3837    }
    38333838    com::SafeArray<BYTE> shapeData(cbShapeSize);
    3834     ::memcpy(shapeData.raw(), pvShape, cbShapeSize);
     3839
     3840    if (pvShape)
     3841        ::memcpy(shapeData.raw(), pvShape, cbShapeSize);
    38353842
    38363843    /* Tell the console about it */
  • trunk/src/VBox/Main/VMMDevInterface.cpp

    r29518 r29542  
    284284
    285285    /* tell the console about it */
    286     size_t cbShapeSize = (width + 7) / 8 * height; /* size of the AND mask */
    287     cbShapeSize = ((cbShapeSize + 3) & ~3) + width * 4 * height; /* + gap + size of the XOR mask */
     286    size_t cbShapeSize = 0;
     287
     288    if (pShape)
     289    {
     290        cbShapeSize = (width + 7) / 8 * height; /* size of the AND mask */
     291        cbShapeSize = ((cbShapeSize + 3) & ~3) + width * 4 * height; /* + gap + size of the XOR mask */
     292    }
    288293    com::SafeArray<BYTE> shapeData(cbShapeSize);
    289     ::memcpy(shapeData.raw(), pShape, cbShapeSize);
     294    if (pShape)
     295        ::memcpy(shapeData.raw(), pShape, cbShapeSize);
    290296    pDrv->pVMMDev->getParent()->onMousePointerShapeChange(fVisible, fAlpha,
    291297                                                          xHot, yHot, width, height, ComSafeArrayAsInParam(shapeData));
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette