[Groonga-commit] groonga/groonga-gobject at 4c9a9c6 [master] Ensure disposing database object

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Jun 14 23:24:40 JST 2014


Kouhei Sutou	2014-06-14 23:24:40 +0900 (Sat, 14 Jun 2014)

  New Revision: 4c9a9c67f150c1ebc7586d48d4246290c4081374
  https://github.com/groonga/groonga-gobject/commit/4c9a9c67f150c1ebc7586d48d4246290c4081374

  Message:
    Ensure disposing database object
    
    Reported by Tomoatsu Shimada. Thanks!!!

  Modified files:
    groonga-gobject/ggrn-context.c

  Modified: groonga-gobject/ggrn-context.c (+12 -2)
===================================================================
--- groonga-gobject/ggrn-context.c    2014-04-28 16:27:19 +0900 (459cb96)
+++ groonga-gobject/ggrn-context.c    2014-06-14 23:24:40 +0900 (6d7c24a)
@@ -152,11 +152,16 @@ ggrn_context_open_database(GGrnContext *context,
                            const gchar *path, GError **error)
 {
     GGrnContextPrivate *priv = GGRN_CONTEXT_GET_PRIVATE(context);
+    gboolean success;
 
     dispose_database(priv);
 
     grn_db_open(priv->ctx, path);
-    return _ggrn_context_check(context, error);
+    success = _ggrn_context_check(context, error);
+    if (success) {
+        priv->own_database = TRUE;
+    }
+    return success;
 }
 
 /**
@@ -177,11 +182,16 @@ ggrn_context_create_database(GGrnContext *context,
                              const gchar *path, GError **error)
 {
     GGrnContextPrivate *priv = GGRN_CONTEXT_GET_PRIVATE(context);
+    gboolean success;
 
     dispose_database(priv);
 
     grn_db_create(priv->ctx, path, NULL);
-    return _ggrn_context_check(context, error);
+    success = _ggrn_context_check(context, error);
+    if (success) {
+        priv->own_database = TRUE;
+    }
+    return success;
 }
 
 /**
-------------- next part --------------
HTML����������������������������...
下载 



More information about the Groonga-commit mailing list
Back to archive index