Unable to use Qt + DXFLib

0

I'm going to use dxflib in my Qt application. Build process is OK but when I'm going to run it, the application stops working at the beginning with this error :

Unhandled exception at 0x776415de in DXFOpen.exe: 0xC00000FD: Stack overflow.

Here is my simple app :

class CreatorAdaptor : public DL_CreationAdapter
{
    QGraphicsScene *_scene;
public:
    explicit CreatorAdaptor(QGraphicsScene *scene);
    virtual void addLine(const DL_LineData &d);
    virtual void addLayer(const DL_LayerData& data);
    virtual void addPoint(const DL_PointData& data);
    virtual void addArc(const DL_ArcData& data);
    virtual void addCircle(const DL_CircleData& data);
    virtual void addPolyline(const DL_PolylineData& data);
    virtual void addVertex(const DL_VertexData& data);
    virtual void add3dFace(const DL_3dFaceData& data);


};

And the definition of the class :

CreatorAdaptor::CreatorAdaptor(QGraphicsScene *scene) :_scene(scene)
{
}

void CreatorAdaptor::addLine(const DL_LineData &d)
{
    qDebug()<<"add line";
    _scene->addLine(d.x1, d.y1, d.x2, d.y2);
}
...

Here is my main :

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QGraphicsView  *view = new QGraphicsView;
    QGraphicsScene  * scene = new QGraphicsScene;
    view->setScene(scene);
    CreatorAdaptor *dxfscene = new CreatorAdaptor(scene);
    DL_Dxf dxf;
     if(dxf.in("demo.dxf", dxfscene))
         QMessageBox::warning(0,"error", "error");
    view->show();
    return a.exec();
}

Call Stack :

    ntdll.dll!77af15de()    
    [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] 
    ntdll.dll!77af15de()    
    ntdll.dll!77ae014e()    
    kernel32.dll!755e14dd()     
>   msvcr100d.dll!_free_base(void * pBlock)  Line 50 + 0x13 bytes   C
    0041f648()  
    QtCored4.dll!qFree(void * ptr)  Line 60 + 0xa bytes C++
    QtCored4.dll!QVectorData::free(QVectorData * x, int alignment)  Line 82 + 0x9 bytes C++
    QtCored4.dll!QVectorTypedData<char *>::free(QVectorTypedData<char *> * x, int alignment)  Line 99 + 0x10 bytes  C++
    QtCored4.dll!QVector<char *>::free(QVectorTypedData<char *> * x)  Line 468 + 0x12 bytes C++
    QtCored4.dll!QVector<char *>::~QVector<char *>()  Line 124 + 0x30 bytes C++
    QtCored4.dll!qWinMain(HINSTANCE__ * instance, HINSTANCE__ * prevInstance, char * cmdParam, int cmdShow, int & argc, QVector<char *> & argv)  Line 193   C++
    0041f7e0()  
    DXFOpen.exe!__security_init_cookie()  Line 143  C
    DXFOpen.exe!WinMainCRTStartup()  Line 371   C
    kernel32.dll!755e339a()     
    ntdll.dll!77b09ef2()    
    ntdll.dll!77b09ec5()    
qt
dxf
asked on Stack Overflow Jul 27, 2013 by s4eed • edited Jul 27, 2013 by s4eed

1 Answer

1

I think you have to write all of the virtual functions as you did with below:

void CreatorAdaptor::addLine(const DL_LineData &d){
     // something something
}

You may left empty them but you must define them because they are defined as virtual functions in the dxf library. Of course, the other option is to delete all of virtual function definitions in the CreatorAdaptor class.

answered on Stack Overflow Mar 31, 2017 by mehmetfa

User contributions licensed under CC BY-SA 3.0