Salome HOME
Merge branch 'rnv/unicode'
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_HypothesesUtils.cxx
index 7aff8c6ce1b4b281c333e3d19cadf152d9832d07..42847411ba21f6d29df4542e7065076733b70973 100644 (file)
@@ -523,15 +523,20 @@ namespace SMESH
         if(MYDEBUG) MESSAGE("Loading client meshers plugin library ...");
 #ifdef WIN32
 #ifdef UNICODE
-               LPTSTR path = new TCHAR[aClientLibName.length() + 1];
-               path[aClientLibName.toWCharArray(path)] = '\0';
+        LPTSTR path = new TCHAR[aClientLibName.length() + 1];
+        path[aClientLibName.toWCharArray(path)] = '\0';
 #else
-               const char* path = aClientLibName.toUtf8().data();
+        QByteArray baPath = aClientLibName.toUtf8();
+        const char* path = baPath.data();
 #endif
 #else
-               char* path = aClientLibName.toUtf8().data();
+        QByteArray baPath = aClientLibName.toUtf8();
+        char* path = baPath.data();
 #endif
         LibHandle libHandle = LoadLib( path );
+#if defined(WIN32) && defined(UNICODE)
+      delete path;
+#endif
         if (!libHandle) {
           // report any error, if occurred
           {