Browse Source

DGraph: Fix dll boundary prob using qPrintable() instead of toStdString()

The following page provides more details regarding dll boundary problem
which could appear when for example a debug executable is linked
against a release library and when memory allocated in one is freed in
the other.

See http://stackoverflow.com/questions/1227653/linking-against-library-in-release-and-exe-in-debug-crashes-in-visual-studio
Jean-Christophe Fillion-Robin 14 years ago
parent
commit
fda766eefb
1 changed files with 7 additions and 7 deletions
  1. 7 7
      Utilities/DGraph/DGraph.cpp

+ 7 - 7
Utilities/DGraph/DGraph.cpp

@@ -42,9 +42,9 @@ QString help(const QString& progName)
 //----------------------------------------------------------------------------
 void displayError(const QString& progName, const QString& msg)
 {
-  std::cerr << QString("%1\n%2\n%3\n").arg(progName).
-                                       arg(msg).
-                                       arg(help(progName)).toStdString();
+  std::cerr << qPrintable(QString("%1\n%2\n%3\n").arg(progName).
+                                                 arg(msg).
+                                                 arg(help(progName)));
 }
 
 //----------------------------------------------------------------------------
@@ -222,7 +222,7 @@ int main(int argc, char** argv)
     
     for(int i = 0; i < path.size(); ++i)
       {
-      std::cerr << vertexIdToLabel[path[i]].toStdString();
+      std::cerr << qPrintable(vertexIdToLabel[path[i]]);
       if (i != path.size() - 1)
         {
         std::cerr << " -> ";
@@ -235,7 +235,7 @@ int main(int argc, char** argv)
 
     for(int i = 0; i < path.size(); ++i)
       {
-      std::cerr << vertexIdToLabel[path[i]].toStdString();
+      std::cerr << qPrintable(vertexIdToLabel[path[i]]);
       if (i != path.size() - 1)
         {
         std::cerr << " -> ";
@@ -296,7 +296,7 @@ int main(int argc, char** argv)
           for(int j=0; j < p->size(); j++)
             {
             int id = p->at(j);
-            std::cout << vertexIdToLabel[id].toStdString();
+            std::cout << qPrintable(vertexIdToLabel[id]);
             if (j != p->size() - 1)
               {
               std::cout << " ";
@@ -321,7 +321,7 @@ int main(int argc, char** argv)
       for(int i=0; i < out.size(); i++)
         {
         int id = out.at(i);
-        std::cout << vertexIdToLabel[id].toStdString();
+        std::cout << qPrintable(vertexIdToLabel[id]);
 
         if (i != out.size() - 1)
           {