![](https://secure.gravatar.com/avatar/e2f8df8fd18408e48e15fd6244a8d9e1.jpg?s=120&d=mm&r=g)
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.
![](https://secure.gravatar.com/avatar/eb3fe37da4a199eb4e3b479d8a57f808.jpg?s=120&d=mm&r=g)
On Tue, 2005-05-31 at 11:59, De Winne, Joris wrote:
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.
Can you get a backtrace from gdb? It would help to know where the segmentation fault is happening.
-mental
![](https://secure.gravatar.com/avatar/eb3fe37da4a199eb4e3b479d8a57f808.jpg?s=120&d=mm&r=g)
Are you calling Inkscape::GC::init() once as well as gtk_init()?
I still wouldn't have expected it to reach the point where it seemingly did, but I still don't have much information to go on. Could you give me a full backtrace rather than just the topmost entry?
-mental
participants (2)
-
De Winne, Joris
-
MenTaLguY