Segfault trying to embed Mozilla using gtkmozembed

Ondaware <[email protected]> Tue, 25 Oct 2005 00:13:51 +0100
Newsgroups gmane.comp.mozilla.devel.gtk
Organization Ondaware, Web Design e Programação
Message-ID <[email protected]>
Hi all

I've been trying to embedd mozilla. This is the test file I created.
Problem is, when I try to run it, it segfaults on the line where it creat=
es the
new browser (browser =3D gtk_moz_embed_new();).

Any help would be appreciated.

Thanks in advance.

-----
This is how I compile it:

g++ \
`gtk-config --libs --cflags` `glib-config --libs --cflags` \
`pkg-config mozilla-gtkmozembed --libs --cflags` \
moztest.cpp=A0=A0-o=A0moztest=A0&&=A0./moztest

--- this is the moztest.cpp file:

#include <gtk/gtk.h>
#include "gtkmozembed.h"
#include "mozilla-config.h"
#include <stdio.h>

int main(int argc, char * argv[])
{
=A0=A0GtkWidget=A0*=A0window;
=A0=A0GtkWidget=A0*=A0browser;

=A0=A0gtk_init(&argc,=A0&argv);

=A0=A0window=A0=3D=A0gtk_window_new(GTK_WINDOW_TOPLEVEL);

=A0=A0printf("Setting=A0up=A0component=A0path.\n");
=A0=A0fflush(stdout);

=A0=A0gtk_moz_embed_set_comp_path("/usr/lib/mozilla");

=A0=A0printf("Setting=A0up=A0profile.\n");
=A0=A0fflush(stdout);

=A0=A0gtk_moz_embed_set_profile_path("/safe/users/joao/.mozilla",=A0"mozi=
lla");

=A0=A0printf("Getting=A0browser.\n");
=A0=A0fflush(stdout);

=A0=A0//=A0browser=A0=3D=A0gtk_moz_embed_new();
=A0=A0browser=A0=3D=A0gtk_moz_embed_new();

=A0=A0printf("Checking=A0browser.\n");
=A0=A0fflush(stdout);

=A0=A0if(!browser)
=A0=A0{
=A0=A0=A0=A0printf("Browser=A0is=A0null.\n");
=A0=A0=A0=A0fflush(stdout);
=A0=A0}

=A0=A0gtk_container_add(GTK_CONTAINER(window),=A0browser);

=A0=A0gtk_moz_embed_load_url(GTK_MOZ_EMBED(browser),=A0"http://www.ondawa=
re.com/");

=A0=A0printf("Here.\n");
=A0=A0fflush(stdout);

=A0=A0gtk_widget_show(window);

=A0=A0gtk_main();

=A0=A0return=A00;
}