[Digikam-devel] digikam just crashed (fwd)

Renchi Raju renchi at pooh.tam.uiuc.edu
Sun Jun 19 20:32:28 BST 2005


duh.... i forgot that recently a patch was applied from gphoto2 upstream 
in gpiface.cpp. and it causes an invalid pointer reference and so a crash. 
i don't have a gphoto2 supported camera anymore and so never saw the bug.

Oliver, i have attached an updated patch which fixes this bug (hopefully). 
can you try it out? you will need to remove the previous patch.

renchi
-------------- next part --------------
Index: utilities/setup/gpiface.cpp
===================================================================
--- utilities/setup/gpiface.cpp	(revision 426554)
+++ utilities/setup/gpiface.cpp	(working copy)
@@ -57,17 +57,35 @@
         return -1;
     }
 
-    for (int i = 0; i < count; i++) {
-        gp_list_get_name  (camList, i, &camModel_);
-        gp_list_get_value (camList, i, &camPort_);
+    camModel_ = 0;
+    camPort_  = 0;
+    
+    for (int i = 0; i < count; i++)
+    {
+        if (gp_list_get_name  (camList, i, &camModel_) != GP_OK)
+        {
+            gp_list_free (camList);
+            return -1;
+        }
+
+        if (gp_list_get_value (camList, i, &camPort_) != GP_OK)
+        {
+            gp_list_free (camList);
+            return -1;
+        }
+
+        if (camModel_ && camPort_)
+        {
+            model = QString::fromLatin1(camModel_);
+            port  = QString::fromLatin1(camPort_);
+            gp_list_free (camList);
+            return 0;
+        }
     }
 
     gp_list_free (camList);
 
-    model = camModel_;
-    port  = camPort_;
-
-    return 0;
+    return -1;
 }
 
 void GPIface::getSupportedCameras(int& count, QStringList& clist)


More information about the Digikam-devel mailing list