언어 설정

Menu
Sites
Language
Webview reload the url with ewk_view_url_set crashed

Hi, 

In my app, I use the the webview to load the webpage, the first time can load successfully, but when I use the ewk_view_url_set to load new url again, the app crashed, anybody know what wrong, any  input is welcome.

 

 

Thanks.

Responses

8 댓글
daniel kim

Hi,

Could you share your code snippet here?

Regards,

Jean Yang

Hi, 

My code like this, after call the create_window(), then call ewk_view_url_set();

typedef struct _Browser_Window {
    Evas_Object *elm_window;
    Evas_Object *ewk_view;

} Browser_Window;

static Browser_Window *window_create(Evas_Object *opener, int width, int height,
        Eina_Bool view_mode) {

    // Allocate memory
    Browser_Window *window = calloc(1, sizeof(Browser_Window));
    if (!window) {
        dlog_print(DLOG_INFO, LOG_TAG, "sizeof(Browser_Window),%d",
                sizeof(Browser_Window));
        return NULL;
    }
    // Create window
    dlog_print(DLOG_INFO, LOG_TAG, "sizeof(Browser_Window),%d",
            sizeof(Browser_Window));

    dlog_print(DLOG_INFO, LOG_TAG, "elm_win_add");
    window->elm_window = elm_win_add(opener, "minibrowser-window",
            ELM_WIN_BASIC);

    ewk_view_user_agent_set(window->ewk_view, "test");
    evas_object_smart_callback_add(window->elm_window, "delete,request",
            on_window_deletion, &window);
    eext_object_event_callback_add(window->elm_window, EEXT_CALLBACK_BACK,
            mini_win_back_cb, window);

    Evas *evas = evas_object_evas_get(window->elm_window);
    window->ewk_view = ewk_view_add(evas);

    elm_win_resize_object_add(window->elm_window, window->ewk_view);
    evas_object_show(window->ewk_view);

    evas_object_show(window->elm_window);

    view_focus_set(window, EINA_TRUE);

   
   ewk_view_url_set(window->ewk_view,first_url);   //-----------fisrt time lode url is OK
    dlog_print(DLOG_INFO, LOG_TAG, "ewk_view_url_set");
    evas_object_smart_callback_add(window->ewk_view, "url,changed",
            url_changed_cb, window);

}

......

ewk_view_url_set(window->ewk_view, other_url)   //-----crashed here

 

 

Alex Dem

Hi,
I have checked with a couple hardcoded URLs. It looks like api works good (on device). Maybe your window->ewk_view is wrong and this is cause of crash.
Alexey.

Jean Yang

Hi Alex,

the Window->ewk_view i have defined as global, I also think something wrong with this, and I have try to call window_create again with different url, it worked as normal.

Alex Dem

But maybe you could provide some additional details to reproduce the issue. To check the issue, I just have copied your code and have performed ewk_view_url_set(ad->ewk_view,"http://www.ya.ru"); inside 'mini_win_back_cb' instead of elm_win_lower(ad->elm_window);
It works ok.
Alexey.

Jean Yang

Hi Alex, 

Below is my scenario:

1. Create 2  button, in button 1 click call back, call the window_create function to create the vebview and load the url(marked as url1) in ewk_view_url_set

2. catch some info in 'url changed' call back

3. back to button screen , click button 2,  try to load the another url2 , crashed, 

after debug, I think that because I have initial the Broswer_window in a local function, and I call the resouse of it outside of it, that cause the issue.

 

Alex Dem

Hi,
1) I have defined Browser_Window as global.
2) Have created object in main();
3) Have created browser window in app_create.
All performed steps were in accordance with the tutorial: https://developer.tizen.org/dev-guide/2.3.0/org.tizen.tutorials/html/native/web/web_tutorials_n.htm#init
Alexey.

Alexey Kiryanov

Hello. Could you send me your project to this task. If it was you. It would be useful for learning to see. I would be very grateful to you.