[Groonga-commit] groonga/groonga at f4c767e [master] Fix a crash bug when a mruby plugin is initialized with multiple threads

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Fri May 6 10:03:19 JST 2016


Kouhei Sutou	2016-05-06 10:03:19 +0900 (Fri, 06 May 2016)

  New Revision: f4c767e544c464a157fed55234933f3432cfe2f3
  https://github.com/groonga/groonga/commit/f4c767e544c464a157fed55234933f3432cfe2f3

  Message:
    Fix a crash bug when a mruby plugin is initialized with multiple threads

  Modified files:
    lib/plugin.c

  Modified: lib/plugin.c (+12 -3)
===================================================================
--- lib/plugin.c    2016-05-06 01:03:15 +0900 (e811cde)
+++ lib/plugin.c    2016-05-06 10:03:19 +0900 (230b892)
@@ -170,12 +170,21 @@ grn_plugin_call_init(grn_ctx *ctx, grn_id id)
 static grn_rc
 grn_plugin_call_register_mrb(grn_ctx *ctx, grn_id id, grn_plugin *plugin)
 {
-  grn_mrb_data *data = &(ctx->impl->mrb);
-  mrb_state *mrb = data->state;
-  struct RClass *module = data->module;
+  grn_mrb_data *data;
+  mrb_state *mrb;
+  struct RClass *module;
   struct RClass *plugin_loader_class;
   int arena_index;
 
+  grn_ctx_impl_mrb_ensure_init(ctx);
+  if (ctx->rc != GRN_SUCCESS) {
+    return ctx->rc;
+  }
+
+  data = &(ctx->impl->mrb);
+  mrb = data->state;
+  module = data->module;
+
   {
     int added;
     grn_hash_add(ctx, ctx->impl->mrb.registered_plugins,
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る