[webkit-gtk] Junk Characters coming on displaying webpage
Monil Parmar
monil.parmar at gmail.com
Mon Mar 14 00:22:24 PDT 2011
Hi,
Iam trying to use gtk based webkit launcher to see the webpages.
*In my program iam calling gtk_init, gtk_main, creation of window and
display of page, quiting gtk_main all in different threads.*
*Now if i open the webpage first time -> it opens fine.*
*then iam quit gtk and relaunching it . This time no webpage is coming lot
of junk characters are coming.*
Any idea what is happening here.
snipet of code:
static GtkWidget*
create_browser ()
{
GtkWidget* scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET
(web_view));
return scrolled_window;
}
void *thread_1(void *param) //gtk _init
{
if (!g_thread_supported ())
g_thread_init (NULL);
gdk_threads_init();
gdk_threads_enter();
gtk_init (NULL,NULL);//&argc, &argv);
gdk_threads_leave();
}
void *thread_2(void *param) //gtk main
{
web_view = WEBKIT_WEB_VIEW (webkit_web_view_new ());
GdkDisplay *display;
gdk_threads_enter();
display=gdk_display_get_default();
gtk_main ();
gdk_display_close(display);
gdk_threads_leave();
}
void *thread_3(void *param) //creating window and display webview
{
gchar* uri;
gdk_threads_enter();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 1280,720);//800, 600);
gtk_container_add (GTK_CONTAINER (window),GTK_WIDGET (web_view));
if (i==0)
{
uri = (gchar*)("http://www.naver.com/");
i++;
}
else
{
uri = (gchar*)("http://www.google.com/");
i--;
}
webkit_web_view_load_uri (web_view, uri);
gtk_widget_show_all (window);
gdk_threads_leave();
printf("\nLEAVING THREAD 3\n");
}
//void *thread_4(void *param)
static gboolean thread_4(void *param) //calling gtk_main_quit
{
gdk_threads_enter();
webkit_web_view_stop_loading(web_view);
web_view=NULL;
sleep(2);
gtk_widget_hide(window);
sleep(2);
gtk_widget_destroy(window);
window=NULL;
gtk_main_quit();
gdk_threads_leave();
return FALSE;
}
int test_gtkapp_quit(void) ///calling destroy
{
// pthread_create(&mythread_4,NULL,thread_4,NULL);
g_timeout_add(50,thread_4, NULL);
}
int main (int argc, char ** argv) //Main function
{
pthread_create(&mythread_1,NULL,thread_1,NULL);
sleep(2);
pthread_create(&mythread_3,NULL,thread_2,NULL);
sleep(3);
pthread_create(&mythread_2,NULL,thread_3,NULL);
return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-gtk/attachments/20110314/4480b03b/attachment.html>
More information about the webkit-gtk
mailing list