X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-stub-ws.c;h=036b4943aee03319cebd4fc2197e1dca2248b61f;hb=587d83da1a6efd68ff45e308dd9691a00fc53fba;hp=164759271ac9f9d172ca124c59010ff6cacb9bd7;hpb=d45426257d5149c735e33e3055220625a919e7bc;p=src%2Fapp-framework-binder.git diff --git a/src/afb-stub-ws.c b/src/afb-stub-ws.c index 16475927..036b4943 100644 --- a/src/afb-stub-ws.c +++ b/src/afb-stub-ws.c @@ -651,10 +651,12 @@ static void on_hangup(void *closure) { struct afb_stub_ws *stubws = closure; + afb_stub_ws_addref(stubws); if (stubws->on_hangup) stubws->on_hangup(stubws); release_sessions(stubws); + afb_stub_ws_unref(stubws); } /*****************************************************/ @@ -707,7 +709,8 @@ void afb_stub_ws_unref(struct afb_stub_ws *stubws) { if (!__atomic_sub_fetch(&stubws->refcount, 1, __ATOMIC_RELAXED)) { drop_all_events(stubws); - afb_evt_listener_unref(stubws->listener); + if (stubws->listener) + afb_evt_listener_unref(stubws->listener); release_sessions(stubws); afb_proto_ws_unref(stubws->proto); afb_cred_unref(stubws->cred);