Fri 18 Feb 2011 09:46:54 PM UTC, original submission:
How to repeat:
int main()
{
while (true)
{
try
{
mysqlpp::Connection conn("Config", "127.2.3.4", "user", "123", 123);
}
catch (...) { }
}
}
To fix i used:
Index: connection.cpp
===================================================================
--- connection.cpp (revision 2685)
+++ connection.cpp (working copy)
@@ -64,7 +64,6 @@
Connection::~Connection()
{
disconnect();
- delete driver_;
}
Index: connection.h
===================================================================
--- connection.h (revision 2685)
+++ connection.h (working copy)
@@ -41,6 +41,7 @@
#include "options.h"
#include <string>
+#include <tr1/memory>
namespace mysqlpp {
@@ -164,7 +165,7 @@
/// the mailing list asking about it. Unless you're doing something
/// very low-level, there should never be a reason to use the
/// driver directly.
- DBDriver* driver() { return driver_; }
+ DBDriver* driver() { return driver_.get(); }
/// \brief Asks the database server to drop (destroy) a database
///
@@ -352,7 +353,7 @@
mutable std::string error_message_; ///< MySQL++ specific error, if
any
private:
- DBDriver* driver_;
+ std::tr1::shared_ptr<DBDriver> driver_;
bool copacetic_;
};
|