[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/graphics/kphotoalbum/SQLDB
From:       Tuomas Suutari <thsuut () utu ! fi>
Date:       2006-08-30 20:23:09
Message-ID: 1156969389.533161.646.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 579014 by suutari:

Don't leave DatabaseHandler half constructed if there occurs an error in initialization.


 M  +11 -2     DatabaseHandler.cpp  


--- trunk/extragear/graphics/kphotoalbum/SQLDB/DatabaseHandler.cpp #579013:579014
@@ -52,10 +52,19 @@
         throw DriverLoadError(_driverManager->errorMsg());
 
     _connection = _driver->createConnection(_connectionData);
-    if (!_connection)
+    if (!_connection) {
+        delete _driver;
         throw ConnectionCreateError(_driver->errorMsg());
+    }
 
-    connect();
+    try {
+        connect();
+    }
+    catch (...) {
+        delete _connection;
+        delete _driver;
+        throw;
+    }
 }
 
 DatabaseHandler::~DatabaseHandler()
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic