From cd5494d715146b8809f3e6ab39510c3a6dd5f82f Mon Sep 17 00:00:00 2001 From: alemuntoni Date: Mon, 25 Oct 2021 14:03:56 +0200 Subject: [PATCH] fix random crash on save ply custom attributes: qUtf8Printable should *never* be used when passing string arguments --- src/meshlabplugins/io_base/baseio.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/meshlabplugins/io_base/baseio.cpp b/src/meshlabplugins/io_base/baseio.cpp index e37b645f9..12b41c7de 100644 --- a/src/meshlabplugins/io_base/baseio.cpp +++ b/src/meshlabplugins/io_base/baseio.cpp @@ -414,25 +414,25 @@ void BaseMeshIOPlugin::save(const QString &formatName, const QString &fileName, // if pname starts with __CA_VS__, it is a PLY per-vertex scalar custom attribute if (pname.startsWith("__CA_VS__")) { if (par.getBool(pname)) { // if it is true, add to save list - pi.addPerVertexScalarAttribute(qUtf8Printable(pname.mid(9)), scalarPlyType); + pi.addPerVertexScalarAttribute(pname.toStdString().substr(9), scalarPlyType); } } // if pname starts with __CA_VP__, it is a PLY per-vertex point3m custom attribute else if (pname.startsWith("__CA_VP__")) { if (par.getBool(pname)) { // if it is true, add to save list - pi.addPerVertexPoint3mAttribute(qUtf8Printable(pname.mid(9)), scalarPlyType); + pi.addPerVertexPoint3mAttribute(pname.toStdString().substr(9), scalarPlyType); } } // if pname starts with __CA_FS__, it is a PLY per-face scalar custom attribute else if (pname.startsWith("__CA_FS__")) { if (par.getBool(pname)) { // if it is true, add to save list - pi.addPerFaceScalarAttribute(qUtf8Printable(pname.mid(9)), scalarPlyType); + pi.addPerFaceScalarAttribute(pname.toStdString().substr(9), scalarPlyType); } } // if pname starts with __CA_FP__, it is a PLY per-face point3m custom attribute else if (pname.startsWith("__CA_FP__")) { if (par.getBool(pname)) { - pi.addPerFacePoint3mAttribute(qUtf8Printable(pname.mid(9)), scalarPlyType); + pi.addPerFacePoint3mAttribute(pname.toStdString().substr(9), scalarPlyType); } } }