I've attached the relevant files and a partial backtrace.

- Swyped from my droid.

On May 22, 2013 7:33 AM, "André Somers" <an...@familiesomers.nl> wrote:

Op 22-5-2013 14:25, Jonathan Greig schreef:

>
> I have an abstract base class that contains a private QHash member.
> There is a public functio...
You'll need to show us the relevant code. Most likely it is a bug on
your side.

André

--
You like Qt?
I am looking for collegues to join me at i-Optics!

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
...
BaseObject Constructor()
CircleObject Constructor()
activeView()

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff62938cc in QHashData::detach_helper2(void (*)(QHashData::Node*, 
void*), void (*)(QHashData::Node*), int, int) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
(gdb) bt
#0  0x00007ffff62938cc in QHashData::detach_helper2(void (*)(QHashData::Node*, 
void*), void (*)(QHashData::Node*), int, int) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#1  0x000000000048ce56 in QHash<QString, QPointF>::detach_helper 
(this=0x13263e8) at /usr/include/qt4/QtCore/qhash.h:584
#2  0x000000000048ccb2 in QHash<QString, QPointF>::detach (this=0x13263e8) at 
/usr/include/qt4/QtCore/qhash.h:303
#3  0x000000000048ca76 in QHash<QString, QPointF>::insert (this=0x13263e8, 
akey=..., avalue=...)
    at /usr/include/qt4/QtCore/qhash.h:756
#4  0x000000000048c9e9 in BaseObject::setObjectRubberPoint (this=0x13263c0, 
key=..., point=...) at object-base.cpp:75
#5  0x000000000044d45c in View::setRubberPoint (this=0xfd19f0, key=..., 
point=...) at view.cpp:153
#6  0x000000000043cf3c in MainWindow::nativeSetRubberPoint (this=0x7e6d80, 
key=..., x=-51.5, y=-35.5)
    at mainwindow-commands.cpp:895
#7  0x000000000049e1dc in javaSetRubberPoint (context=0x7fffdfc00138) at 
javascript/native-javascript.cpp:363
#8  0x00007ffff7b1dca8 in ?? () from /usr/lib/x86_64-linux-gnu/libQtScript.so.4
...
void View::setRubberPoint(const QString& key, const QPointF& point)
{
    foreach(QGraphicsItem* item, rubberRoomItemGroup->childItems())
    {
        BaseObject* base = (BaseObject*)item;
        if(base) { base->setObjectRubberPoint(key, point); }
    }
}
#ifndef OBJECT_BASE_H
#define OBJECT_BASE_H

#include <QHash>
#include <QPen>
#include <QtCore/qmath.h>

class BaseObject
{
public:
    BaseObject();
    virtual ~BaseObject();

    QPen         objectPen()                           const { return objPen; }
    QColor       objectColor()                         const { return objPen.color(); }
    QRgb         objectColorRGB()                      const { return objPen.color().rgb(); }
    Qt::PenStyle objectLineType()                      const { return objPen.style(); }
    qreal        objectLineWeight()                    const { return lwtPen.widthF(); }
    QPainterPath objectPath()                          const { return objPath; }
    int          objectRubberMode()                    const { return objRubberMode; }
    QPointF      objectRubberPoint(const QString& key) const { return objRubberPoints.value(key); }

    void setObjectColor(const QColor& color);
    void setObjectColorRGB(QRgb rgb);
    void setObjectLineType(Qt::PenStyle lineType);
    void setObjectLineWeight(qreal lineWeight);
    void setObjectPath(const QPainterPath& path);
    void setObjectRubberMode(int mode) { objRubberMode = mode; }
    void setObjectRubberPoint(const QString& key, const QPointF& point);

    virtual QPointF mouseSnapPoint(const QPointF& mousePoint) = 0;
    virtual QList<QPointF> allGripPoints() = 0;
protected:
    QPen lineWeightPen() const { return lwtPen; }
    inline qreal pi() const { return (qAtan(1.0)*4.0); }
    inline qreal radians(qreal degree) const { return (degree*pi()/180.0); }
    inline qreal degrees(qreal radian) const { return (radian*180.0/pi()); }
private:
    QPen objPen;
    QPen lwtPen;
    QPainterPath objPath;
    int objRubberMode;
    QHash<QString, QPointF> objRubberPoints;
};

#endif
#include "object-base.h"
#include "object-data.h"

#include <QMessageBox>

BaseObject::BaseObject()
{
    qDebug("BaseObject Constructor()");

    //snip
}

BaseObject::~BaseObject()
{
    qDebug("BaseObject Destructor()");
}

void BaseObject::setObjectColor(const QColor& color)
{
    //snip
}

void BaseObject::setObjectColorRGB(QRgb rgb)
{
    //snip
}

void BaseObject::setObjectLineType(Qt::PenStyle lineType)
{
    //snip
}

void BaseObject::setObjectLineWeight(qreal lineWeight)
{
    //snip
}

void BaseObject::setObjectPath(const QPainterPath& path)
{
    //snip
}

void BaseObject::setObjectRubberPoint(const QString& key, const QPointF& point)
{
    objRubberPoints.insert(key, point); // <--- segfaults here
}
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to