From 424f66111273b352ca0ee35a397537446a2c3be5 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 12 Feb 2017 21:13:03 +0200 Subject: [PATCH] Fix export to dxf. --HG-- branch : develop --- src/app/valentina/mainwindowsnogui.cpp | 8 +++++--- src/libs/vdxf/dxflib/dl_dxf.cpp | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index ce764ac6f..426c1288c 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -795,9 +795,11 @@ void MainWindowsNoGUI::DxfFile(const QString &name, int i) const } QPainter painter; - painter.begin(&generator); - scenes.at(i)->render(&painter, paper->rect(), paper->rect(), Qt::IgnoreAspectRatio); - painter.end(); + if (painter.begin(&generator)) + { + scenes.at(i)->render(&painter, paper->rect(), paper->rect(), Qt::IgnoreAspectRatio); + painter.end(); + } } } diff --git a/src/libs/vdxf/dxflib/dl_dxf.cpp b/src/libs/vdxf/dxflib/dl_dxf.cpp index 80ff93356..c4cf29ed4 100644 --- a/src/libs/vdxf/dxflib/dl_dxf.cpp +++ b/src/libs/vdxf/dxflib/dl_dxf.cpp @@ -2549,8 +2549,9 @@ void DL_Dxf::endSequence(DL_CreationInterface* creationInterface) */ DL_WriterA* DL_Dxf::out(const char* file, DL_Codes::version version) { - char* f = new char[strlen(file)+1]; - strlcpy(f, file, sizeof(f)); + const int size = strlen(file)+1; + char* f = new char[size]; + strlcpy(f, file, size); // Strange thing the sizeof(f) doesn't return correct value this->version = version; DL_WriterA* dw = new DL_WriterA(f, version);