[GRASS-SVN] r67391 - in grass/branches/releasebranch_7_0: include/defs lib/db/dbmi_client

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Dec 27 03:09:23 PST 2015


Author: martinl
Date: 2015-12-27 03:09:23 -0800 (Sun, 27 Dec 2015)
New Revision: 67391

Modified:
   grass/branches/releasebranch_7_0/include/defs/dbmi.h
   grass/branches/releasebranch_7_0/lib/db/dbmi_client/handler.c
   grass/branches/releasebranch_7_0/lib/db/dbmi_client/shutdown.c
Log:
attempt to fix #2711 (segfault caused by db error handler)
        (merge r65741 from trunk)


Modified: grass/branches/releasebranch_7_0/include/defs/dbmi.h
===================================================================
--- grass/branches/releasebranch_7_0/include/defs/dbmi.h	2015-12-27 09:02:19 UTC (rev 67390)
+++ grass/branches/releasebranch_7_0/include/defs/dbmi.h	2015-12-27 11:09:23 UTC (rev 67391)
@@ -332,6 +332,7 @@
 void db_set_error_who(const char *);
 int db_set_handle(dbHandle *, const char *, const char *);
 void db_set_error_handler_driver(dbDriver *);
+void db_unset_error_handler_driver(dbDriver *);
 int db_set_index_column_name(dbIndex *, int,
 			     const char *);
 int db_set_index_name(dbIndex *, const char *);

Modified: grass/branches/releasebranch_7_0/lib/db/dbmi_client/handler.c
===================================================================
--- grass/branches/releasebranch_7_0/lib/db/dbmi_client/handler.c	2015-12-27 09:02:19 UTC (rev 67390)
+++ grass/branches/releasebranch_7_0/lib/db/dbmi_client/handler.c	2015-12-27 11:09:23 UTC (rev 67391)
@@ -19,7 +19,6 @@
     dbDriver *driver;
 
     driver = (dbDriver *) p;
-    
     db_close_database(driver);
     db_shutdown_driver(driver);
 }
@@ -40,3 +39,13 @@
 {
     G_add_error_handler(error_handler_driver, driver);
 }
+
+/*!
+  \brief Remove error handler before closing the driver
+
+  \param driver DB driver
+*/
+void db_unset_error_handler_driver(dbDriver *driver)
+{
+    G_remove_error_handler(error_handler_driver, driver);
+}

Modified: grass/branches/releasebranch_7_0/lib/db/dbmi_client/shutdown.c
===================================================================
--- grass/branches/releasebranch_7_0/lib/db/dbmi_client/shutdown.c	2015-12-27 09:02:19 UTC (rev 67390)
+++ grass/branches/releasebranch_7_0/lib/db/dbmi_client/shutdown.c	2015-12-27 11:09:23 UTC (rev 67391)
@@ -55,6 +55,9 @@
 
     driver->pid = 0;
 
+    /* remove also error handler if defined */
+    db_unset_error_handler_driver(driver);
+    
     /* free the driver structure. THIS IS GOOFY */
     db_free(driver);
 



More information about the grass-commit mailing list