I have been trying to create a view for showing graph using cairo. This view is supposed to get created when a button is clicked. So I added the following code
in a function and called it from the button's callback function.
Eina_Bool view_history_create(void *data)
{
Evas_Object *nf = (Evas_Object *)data;
// nf is pointer to parent naviframe container
appdata_s *ad = {0,};
dlog_print(DLOG_ERROR, LOG_TAG, "Creating evas_object_image.");
ad->img = evas_object_image_filled_add(evas_object_evas_get(nf));
dlog_print(DLOG_ERROR, LOG_TAG, "Showing image.");
evas_object_show(ad->img);
dlog_print(DLOG_ERROR, LOG_TAG, "Calling evas_object_geometry_get...");
evas_object_geometry_get(nf, NULL, NULL, &ad->width, &ad->height);
dlog_print(DLOG_ERROR, LOG_TAG, "Calling cairo_image_surface_create...");
ad->surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, ad->width, ad->height);
dlog_print(DLOG_ERROR, LOG_TAG, "Calling cairo_create...");
ad->cairo = cairo_create(ad->surface);
dlog_print(DLOG_ERROR, LOG_TAG, "Calling cairo_drawing...");
cairo_drawing(ad);
dlog_print(DLOG_ERROR, LOG_TAG, "Calling elm_naviframe_item_push...");
elm_naviframe_item_push(nf, "History", NULL, NULL, ad->img, NULL);
dlog_print(DLOG_ERROR, LOG_TAG, "Returning...");
return EINA_TRUE;
}
With the log, I found that the app crashes after calling the function evas_object_image_filled_add. So, I want to know what am I doing wrong here? What can I do to fix this?