screen_connector_toolkit_ops *ops, void *data)
{
screen_connector_toolkit_h toolkit_h = NULL;
+ screen_connector_toolkit_ops *ops_copy;
+
+ ops_copy = (screen_connector_toolkit_ops *)calloc(1, sizeof(screen_connector_toolkit_ops));
+ if (ops_copy == NULL) {
+ LOGE("ops_copy calloc fail");
+ return NULL;
+ }
+ memcpy(ops_copy, ops, sizeof(screen_connector_toolkit_ops));
toolkit_h = (screen_connector_toolkit_h)calloc(1, sizeof(struct _screen_connector_toolkit_h));
if (toolkit_h == NULL) {
LOGE("toolkit_h calloc fail");
+ free(ops_copy);
return NULL;
}
toolkit_h->surface_id = surface_id;
toolkit_h->appid = strdup(id);
toolkit_h->instance_id = strdup(id);
toolkit_h->data = data;
- toolkit_h->ops = ops;
+ toolkit_h->ops = ops_copy;
return toolkit_h;
}
{
screen_connector_toolkit_h toolkit_h = NULL;
screen_connector_type_h type_h = NULL;
+ screen_connector_toolkit_ops *ops_copy;
if (id == NULL || ops == NULL) {
LOGE("Invalid param");
return NULL;
}
+ ops_copy = (screen_connector_toolkit_ops *)calloc(1, sizeof(screen_connector_toolkit_ops));
+ if (ops_copy == NULL) {
+ LOGE("ops_copy calloc fail");
+ return NULL;
+ }
+ memcpy(ops_copy, ops, sizeof(screen_connector_toolkit_ops));
+
toolkit_h = (screen_connector_toolkit_h)calloc(1, sizeof(struct _screen_connector_toolkit_h));
if (toolkit_h == NULL) {
LOGE("toolkit_h calloc fail");
+ free(ops_copy);
return NULL;
}
+
toolkit_h->instance_id = strdup(id);
toolkit_h->data = data;
- toolkit_h->ops = ops;
+ toolkit_h->ops = ops_copy;
toolkit_h->type_h = type_h;
if (type_h->toolkit_table == NULL)
{
screen_connector_toolkit_evas_h handle;
screen_connector_toolkit_evas_ops *evas_ops;
- screen_connector_toolkit_ops *toolkit_ops;
+ screen_connector_toolkit_ops toolkit_ops;
screen_connector_type_evas_h type_h;
int int_type = type;
return NULL;
}
- toolkit_ops = (screen_connector_toolkit_ops *)calloc(1, sizeof(screen_connector_toolkit_ops));
- toolkit_ops->added_cb = __toolkit_added_cb;
- toolkit_ops->updated_cb = __toolkit_update_cb;
- toolkit_ops->removed_cb = __toolkit_removed_cb;
+ toolkit_ops.added_cb = __toolkit_added_cb;
+ toolkit_ops.updated_cb = __toolkit_update_cb;
+ toolkit_ops.removed_cb = __toolkit_removed_cb;
evas_ops = (screen_connector_toolkit_evas_ops *)calloc(1, sizeof(screen_connector_toolkit_evas_ops));
if (evas_ops == NULL) {
handle->ops = evas_ops;
handle->data = data;
handle->type_h = type_h;
- handle->toolkit_h = screen_connector_toolkit_add(toolkit_ops, id, type, handle);
+ handle->toolkit_h = screen_connector_toolkit_add(&toolkit_ops, id, type, handle);
return handle;
}
{
screen_connector_toolkit_evas_h handle;
screen_connector_toolkit_evas_ops *evas_ops;
- screen_connector_toolkit_ops *toolkit_ops;
+ screen_connector_toolkit_ops toolkit_ops;
screen_connector_type_evas_h type_h;
char rid_str[32];
return NULL;
}
- toolkit_ops = (screen_connector_toolkit_ops *)calloc(1, sizeof(screen_connector_toolkit_ops));
- toolkit_ops->added_cb = __toolkit_added_cb;
- toolkit_ops->updated_cb = __toolkit_update_cb;
- toolkit_ops->removed_cb = __toolkit_removed_cb;
+ toolkit_ops.added_cb = __toolkit_added_cb;
+ toolkit_ops.updated_cb = __toolkit_update_cb;
+ toolkit_ops.removed_cb = __toolkit_removed_cb;
evas_ops = (screen_connector_toolkit_evas_ops *)calloc(1, sizeof(screen_connector_toolkit_evas_ops));
if (evas_ops == NULL) {
handle->type_h = type_h;
snprintf(rid_str, sizeof(rid_str), "%d", res_id);
- handle->toolkit_h = screen_connector_toolkit_create_handle(rid_str, res_id, toolkit_ops, handle);
+ handle->toolkit_h = screen_connector_toolkit_create_handle(rid_str, res_id, &toolkit_ops, handle);
screen_connector_toolkit_redirect_surface(handle->toolkit_h);
return handle;