s3-mdssvc: use default g_main context
authorRalph Boehme <slow@samba.org>
Mon, 25 Mar 2019 15:11:30 +0000 (16:11 +0100)
committerRalph Boehme <slow@samba.org>
Wed, 24 Apr 2019 18:32:15 +0000 (18:32 +0000)
Way back when the module was developed it seemed to be necessary the use
a private context with push/pop as thread default. Maybe there was a bug
in libtracker-sparql dispatching callback in the wrong (global)
context. It's not necessary anymore with a recent libtracker-sparql
version.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
source3/rpc_server/mdssvc/mdssvc.c

index c8545a52e5517f38bbe76ff544ba6ba10980076b..e297333ad160e6bf08cd5602c56fbb741ccfcb5a 100644 (file)
@@ -1818,18 +1818,12 @@ static struct mdssvc_ctx *mdssvc_init(struct tevent_context *ev)
 
        mdssvc_ctx->ev_ctx = ev;
 
-       mdssvc_ctx->gmain_ctx = g_main_context_new();
+       mdssvc_ctx->gmain_ctx = g_main_context_default();
        if (mdssvc_ctx->gmain_ctx == NULL) {
                DBG_ERR("error from g_main_context_new\n");
                return NULL;
        }
 
-       /*
-        * This ensures all glib threads, especially gioi worker threads
-        * dispatch their async callbacks via our gmain_ctx.
-        */
-       g_main_context_push_thread_default(mdssvc_ctx->gmain_ctx);
-
        mdssvc_ctx->glue = samba_tevent_glib_glue_create(ev,
                                                         mdssvc_ctx->ev_ctx,
                                                         mdssvc_ctx->gmain_ctx);
@@ -1861,8 +1855,6 @@ bool mds_shutdown(void)
        samba_tevent_glib_glue_quit(mdssvc_ctx->glue);
        TALLOC_FREE(mdssvc_ctx->glue);
 
-       g_main_context_pop_thread_default(mdssvc_ctx->gmain_ctx);
-
        TALLOC_FREE(mdssvc_ctx);
 
        return true;