afb-stub-ws: Protect against self-destruction
[src/app-framework-binder.git] / src / afb-stub-ws.c
index 1647592..a8af53c 100644 (file)
@@ -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);
 }
 
 /*****************************************************/