Hello,
I'm trying to create a viewer based on the inkscape SVG viewer. I based my viewer on the code in inkview.cpp. But during execution I always get a segmentation fault when I call sp_document_new.
I create a LayoutRenderer and on that object I call the function renderLayout.
Here's some part of the code I use:
LayoutRenderer::LayoutRenderer() {
changed = false;
uriLatest = "latest.svg";
vector<string> result;
vector<string>::iterator it;
result = Util::putFileInVector(uriLatest);
latest = "";
it = result.begin();
while(it != result.end()) {
latest += *it + "\n";
it++;
}
Inkscape::GC::init();
setlocale (LC_NUMERIC, "C");
if (result.size() > 0) {
changed = true;
}
}
void LayoutRenderer::renderLayout() {
cout << "Start rendering \n";
GtkWidget * w = gtk_window_new (GTK_WINDOW_TOPLEVEL);
cout << "Created new window\n";
SPDocument * doc = sp_document_new (uriLatest.c_str(), TRUE, TRUE, false);
cout << "Created new document\n";
GtkWidget * view = sp_svg_view_widget_new (doc);
cout << "Created new view\n";
cout << "rendering created objects \n";
sp_svg_view_widget_set_resize (SP_SVG_VIEW_WIDGET (view), FALSE, sp_document_width (doc), sp_document_height (doc));
sp_document_ensure_up_to_date (doc);
sp_document_unref (doc);
gtk_widget_show (view);
cout << "rendering add to container\n";
gtk_container_add (GTK_CONTAINER (w), view);
gtk_widget_show (w);
cout << "Start rgoing to main loop\n";
gtk_main ();
}
The function gtk_init (&argc, (char ***) &argv); has been called prior to all the rendering calls. This is the output I get:
Start rendering
Created new window
Segmentation fault
Any help is welcome?
Thnx,
Joris
- - - - - - - DISCLAIMER- - - - - - - -
Unless indicated otherwise, the information contained in this message is privileged and confidential, and is intended only for the use of the addressee(s) named above and others who have been specifically authorized to receive it. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message and/or attachments is strictly prohibited. The company accepts no liability for any damage caused by any virus transmitted by this email. Furthermore, the company does not warrant a proper and complete transmission of this information, nor does it accept liability for any delays. If you have received this message in error, please contact the sender and delete the message. Thank you.