{
struct packet *packet;
+ if (!inst->pd.need_to_send_close_event) {
+ ErrPrint("PD is not created\n");
+ return LB_STATUS_ERROR_INVALID;
+ }
+
packet = packet_create_noack("pd_destroyed", "ssi", package_name(inst->info), inst->id, status);
if (!packet) {
ErrPrint("Failed to create a packet\n");
return LB_STATUS_ERROR_FAULT;
}
+ inst->pd.need_to_send_close_event = 0;
+
return CLIENT_SEND_EVENT(inst, packet);
}
struct event_item *item;
struct tag_item *tag_item;
+ (void)send_pd_destroyed_to_client(inst, LB_STATUS_SUCCESS);
+
invoke_delete_callbacks(inst);
pkg = inst->info;
DbgPrint("Instance is destroyed (%p), slave(%p)\n", inst, slave);
- if (inst->pd.need_to_send_close_event) {
- send_pd_destroyed_to_client(inst, 0);
- }
-
if (lb_type == LB_TYPE_SCRIPT) {
script_handler_unload(inst->lb.canvas.script, 0);
script_handler_destroy(inst->lb.canvas.script);
HAPI int instance_client_pd_destroyed(struct inst_info *inst, int status)
{
- if (!inst->pd.need_to_send_close_event) {
- ErrPrint("PD is not created\n");
- return LB_STATUS_ERROR_INVALID;
- }
-
- inst->pd.need_to_send_close_event = 0;
-
return send_pd_destroyed_to_client(inst, status);
}
if (instance_unref(inst)) {
int ret;
+
+ /*!
+ * If the instance is not deleted, we should send pd-destroy event from here.
+ */
ret = instance_client_pd_destroyed(inst, LB_STATUS_SUCCESS);
if (ret < 0) {
ErrPrint("Failed sending PD Destroy event (%d)\n", ret);