<div>Hi,</div>
<div>Iam trying to use gtk based webkit launcher to see the webpages.</div>
<div> </div>
<div><strong>In my program iam calling gtk_init, gtk_main, creation of window and display of page, quiting gtk_main  all in different threads.</strong></div>
<div><strong>Now if i open the webpage first time -> it opens fine.</strong></div>
<div><strong>then iam quit gtk and relaunching it . This time no webpage is coming lot of junk characters are coming.</strong></div>
<div> </div>
<div>Any idea what is happening here.</div>
<div>snipet of code:</div>
<div> </div>
<div>static GtkWidget*<br>create_browser ()<br>{<br>    GtkWidget* scrolled_window = gtk_scrolled_window_new (NULL, NULL);<br>    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);</div>

<div>    gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (web_view));</div>
<div>    return scrolled_window;<br>}<br>void *thread_1(void *param) //gtk _init</div>
<div>{<br>    if (!g_thread_supported ())<br>        g_thread_init (NULL);<br>    gdk_threads_init();<br>        gdk_threads_enter();<br>    gtk_init (NULL,NULL);//&argc, &argv);<br>    gdk_threads_leave();<br>}<br>
void *thread_2(void *param)  //gtk main<br>{<br>    web_view = WEBKIT_WEB_VIEW (webkit_web_view_new ());<br>        GdkDisplay *display;<br>    gdk_threads_enter();</div>
<div>        display=gdk_display_get_default();<br>    gtk_main ();<br>        gdk_display_close(display);<br>    gdk_threads_leave();<br>}<br>void *thread_3(void *param) //creating window and display webview<br>{<br>        gchar* uri;<br>
    gdk_threads_enter();<br>    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);<br>    gtk_window_set_default_size (GTK_WINDOW (window), 1280,720);//800, 600);<br>    gtk_container_add (GTK_CONTAINER (window),GTK_WIDGET (web_view));<br>
        if (i==0)<br>        {<br>            uri = (gchar*)("<a href="http://www.naver.com/">http://www.naver.com/</a>");<br>                i++;<br>        }<br>        else<br>        {<br>            uri = (gchar*)("<a href="http://www.google.com/">http://www.google.com/</a>");<br>
                i--;<br>        }<br>    webkit_web_view_load_uri (web_view, uri);<br>    gtk_widget_show_all (window);<br>    gdk_threads_leave();<br>    printf("\nLEAVING THREAD 3\n");<br>}<br>//void *thread_4(void *param)<br>
static gboolean  thread_4(void *param) //calling gtk_main_quit<br>{<br>    gdk_threads_enter();<br>        webkit_web_view_stop_loading(web_view);<br>        web_view=NULL;<br>        sleep(2);<br>        gtk_widget_hide(window);<br>
        sleep(2);<br>       gtk_widget_destroy(window);<br>        window=NULL;<br>        gtk_main_quit();<br>    gdk_threads_leave();<br>        return FALSE;<br>}<br>int test_gtkapp_quit(void) ///calling destroy <br>{<br>
//    pthread_create(&mythread_4,NULL,thread_4,NULL);<br>        g_timeout_add(50,thread_4, NULL);<br>}<br></div>
<div> </div>
<div>int main (int argc, char ** argv) //Main function<br>{<br>    pthread_create(&mythread_1,NULL,thread_1,NULL);<br>    sleep(2);<br>    pthread_create(&mythread_3,NULL,thread_2,NULL);<br>    sleep(3);<br>    pthread_create(&mythread_2,NULL,thread_3,NULL);<br>
    return 0;<br>}<br></div>