[Uml-devel] kdesdk/umbrello/umbrello/clipboard
Tobias Koenig
tokoe at kde.org
Fri Nov 19 10:56:02 UTC 2004
CVS commit by tokoe:
Fixed the crash that happens when selecting an element in the diagram and
pressing Ctrl+X, Ctrl+V
QByteArray.setRawData() -> QByteArray.resize() because QDataStream::operator<<
touches the data and that's not ok for data set with setRawData...
QMemArray -> QValueStack because QMemArray + std::string doesn't like each other
it seems...
M +17 -12 idchangelog.h 1.6
M +2 -2 umldrag.cpp 1.27
--- kdesdk/umbrello/umbrello/clipboard/idchangelog.h #1.5:1.6
@@ -27,5 +27,5 @@
#include <qstring.h>
-#include <qmemarray.h>
+#include <qvaluevector.h>
#include "../umlnamespace.h"
@@ -96,21 +96,26 @@ private:
class Point {
public:
- Point(Uml::IDType x, Uml::IDType y) { m_x = x; m_y = y; }
+ Point()
+ {}
+ Point(const Uml::IDType &x, const Uml::IDType &y)
+ : m_x(x), m_y(y)
+ {}
virtual ~Point() {}
- void setX( Uml::IDType x ) { m_x = x; }
- Uml::IDType x() { return m_x; }
- void setY( Uml::IDType y ) { m_y = y; }
- Uml::IDType y() { return m_y; }
+ void setX(const Uml::IDType &x) { m_x = x; }
+ Uml::IDType x() const { return m_x; }
+ void setY(const Uml::IDType &y) { m_y = y; }
+ Uml::IDType y() const { return m_y; }
private:
Uml::IDType m_x, m_y;
};
- class PointArray : QMemArray<Point> {
+ class PointArray : QValueVector<Point> {
public:
- void setPoint( uint i, Uml::IDType x, Uml::IDType y ) {
- QMemArray<Point>::at(i) = Point(x, y);
+ void setPoint(uint i, const Uml::IDType &x, const Uml::IDType &y) {
+ Point point(x, y);
+ QValueVector<Point>::at(i) = point;
}
- Point& point( uint i ) const { return QMemArray<Point>::at(i); }
- uint size() const { return QMemArray<Point>::size(); }
- bool resize( uint size ) { return QMemArray<Point>::resize(size); }
+ const Point& point( uint i ) const { return QValueVector<Point>::at(i); }
+ uint size() const { return QValueVector<Point>::size(); }
+ bool resize( uint size ) { QValueVector<Point>::resize(size); return true; }
};
PointArray m_LogArray;
--- kdesdk/umbrello/umbrello/clipboard/umldrag.cpp #1.26:1.27
@@ -103,4 +103,5 @@ void UMLDrag::setSubType(const QCString&
void UMLDrag::setEncodedData(const QByteArray& encodedData, int index) {
+ encodedData.copy();
data->enc[index] = encodedData.copy();
}
@@ -259,7 +260,6 @@ void UMLDrag::setUMLDataClip4(UMLObjectL
data->setType("image/PNG", 1);
long l_size = (pngImage.convertToImage()).numBytes();
- char* data = new char[l_size];
QByteArray clipdata;
- clipdata.setRawData(data, l_size);
+ clipdata.resize(l_size);
QDataStream clipstream(clipdata, IO_WriteOnly);
clipstream << pngImage;
More information about the umbrello-devel
mailing list