diff --git a/src/libs/vdxf/libdxfrw/libdxfrw.cpp b/src/libs/vdxf/libdxfrw/libdxfrw.cpp index 7bef30b0c..3e9acbf56 100644 --- a/src/libs/vdxf/libdxfrw/libdxfrw.cpp +++ b/src/libs/vdxf/libdxfrw/libdxfrw.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include "intern/drw_textcodec.h" #include "intern/dxfreader.h" #include "intern/dxfwriter.h" @@ -2541,18 +2542,18 @@ bool dxfRW::processPolyline() { bool dxfRW::processVertex(DRW_Polyline *pl) { DRW_DBG("dxfRW::processVertex"); int code; - DRW_Vertex *v = new DRW_Vertex(); + QScopedPointer v(new DRW_Vertex()); while (reader->readRec(&code)) { DRW_DBG(code); DRW_DBG("\n"); switch (code) { case 0: { - pl->appendVertex(v); + pl->appendVertex(v.take()); nextentity = reader->getString(); DRW_DBG(nextentity); DRW_DBG("\n"); if (nextentity == "SEQEND") { return true; //found SEQEND no more vertex, terminate } else if (nextentity == "VERTEX"){ - v = new DRW_Vertex(); //another vertex + v.reset(new DRW_Vertex()); //another vertex } } DRW_FALLTHROUGH @@ -2561,7 +2562,6 @@ bool dxfRW::processVertex(DRW_Polyline *pl) { break; } } - delete v; return true; }