glom r1517 - in trunk: . glom glom/libglom glom/utility_widgets/db_adddel
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: glom r1517 - in trunk: . glom glom/libglom glom/utility_widgets/db_adddel
- Date: Wed, 2 Apr 2008 21:32:07 +0100 (BST)
Author: murrayc
Date: Wed Apr 2 21:32:07 2008
New Revision: 1517
URL: http://svn.gnome.org/viewvc/glom?rev=1517&view=rev
Log:
2008-04-02 Murray Cumming <murrayc murrayc com>
* glom/libglom/connectionpool.cc
* glom/libglom/connectionpool.h Added delete_instance().
* glom/main.cc (main): Clean up the ConnectionPool singleton at the
end, so it is not reported as a leak by valgrind.
Modified:
trunk/ChangeLog
trunk/glom/libglom/connectionpool.cc
trunk/glom/libglom/connectionpool.h
trunk/glom/main.cc
trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc
Modified: trunk/glom/libglom/connectionpool.cc
==============================================================================
--- trunk/glom/libglom/connectionpool.cc (original)
+++ trunk/glom/libglom/connectionpool.cc Wed Apr 2 21:32:07 2008
@@ -226,11 +226,20 @@
return m_instance;
else
{
- m_instance = new ConnectionPool(); //TODO: Does it matter that this is never deleted?
+ m_instance = new ConnectionPool();
return m_instance;
}
}
+void ConnectionPool::delete_instance()
+{
+ if(m_instance)
+ {
+ delete m_instance;
+ m_instance = 0;
+ }
+}
+
bool ConnectionPool::get_ready_to_connect() const
{
return m_ready_to_connect;
Modified: trunk/glom/libglom/connectionpool.h
==============================================================================
--- trunk/glom/libglom/connectionpool.h (original)
+++ trunk/glom/libglom/connectionpool.h Wed Apr 2 21:32:07 2008
@@ -108,8 +108,14 @@
public:
+ /** Get the singleton instance.
+ * Use delete_instance() when the program quits.
+ */
static ConnectionPool* get_instance();
+ /// Delete the singleton so it doesn't show up as leaked memory in, for instance, valgrind.
+ static void delete_instance();
+
bool get_ready_to_connect() const;
void set_ready_to_connect(bool val = true);
Modified: trunk/glom/main.cc
==============================================================================
--- trunk/glom/main.cc (original)
+++ trunk/glom/main.cc Wed Apr 2 21:32:07 2008
@@ -189,7 +189,7 @@
PySys_SetArgv(argc, argv);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
- //try
+ try
#endif
{
#ifndef GLOM_ENABLE_MAEMO
@@ -278,7 +278,7 @@
else
delete pApp_Glom;
}
-#if 0 //#ifdef GLIBMM_EXCEPTIONS_ENABLED
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
catch(const Glib::Exception& ex)
{
//If this happens then comment out the try/catch, and let the debugger show the call stack.
@@ -294,6 +294,9 @@
//We use python for calculated-fields:
Py_Finalize();
+ //Clean up singletons:
+ Glom::ConnectionPool::delete_instance();
+
return 0;
}
Modified: trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc
==============================================================================
--- trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc (original)
+++ trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc Wed Apr 2 21:32:07 2008
@@ -246,7 +246,7 @@
void DbTreeModelRow::fill_values_if_necessary(DbTreeModel& model, int row)
{
- //std::cout << "DbTreeModelRow::fill_values_if_necessary(): row=" << row << std::endl;
+ std::cout << "DbTreeModelRow::fill_values_if_necessary(): row=" << row << std::endl;
if(row == 1000)
{
std::cout << "1000" << std::endl;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]