Hi all
As I tested some grid snapping highlighting features I'm currently working on, I found a nasty bug causing a big crash. I just reproduced it 2 minutes ago with the last devel cvs.
Open inkscape, open "document properties", check grid on, close "document properties" (optionnal), hit Ctrl-S. [CRASH]
with a little debugging infos it seams that during inkscape init, an SPDesktop is created, filled with a SPnamedview filled with a SPdocument... and then, before the user can do anything with the app, a new SPnamedview is created as long as a new SPdocument... but the SPDesktop don't know about it, so it still knows the "old" SPdocument passed to him earlier but not the "new" one...
So toggling grid display and hitting Ctrl-S reaches sp_document_maybe_done() in document-undo.cpp with an "old" SPdocument (which doesn't seam to have been destroyed so it's probably still there in memory), and the third assert (on doc->priv->sensitive) crashes the app.
As I'm no application init guru (hum... I'm no guru _at all_), could anyone who knows desktop/namedview/document combination have a look at that ?
Is this double namedview/document normal ?
I reproduced that with an empty document AND with an svg document of mine opened through a parameter in shell.
I join my little std::cout debuging info and the backtrace.
mtou
---------------------------- [SPDocument::SPDocument]0x8586f78 [sp_namedview_build] building [0x85064c8] namedview with [0x8586f78] document ** Message: Beginning icon prerendering [SPDesktop::init] [0x85064c8] namedview gave [0x8586f78] document [SPDesktop::init] just before setDocument [SPDesktop::setDocument] [0x858be00] desktop is fed [0x8586f78] document [SPDesktop::init] just after setDocument [SPDocument::SPDocument]0x8586f30 [sp_namedview_build] building [0x8506338] namedview with [0x8586f30] document ** Message: Icon prerendering complete after 2,31829 seconds
Here, I toogle grid displaying ON
[PageSizer::setDoc] got [0x8586f78] from [0x858be00] SP_ACTIVE_DESKTOP [sp_document_maybe_done] called with [0x8586f78] document, crash in 3 lines [PageSizer::setDoc] got [0x8586f78] from [0x858be00] SP_ACTIVE_DESKTOP [sp_document_maybe_done] called with [0x8586f78] document, crash in 3 lines [PageSizer::setDoc] got [0x8586f78] from [0x858be00] SP_ACTIVE_DESKTOP [sp_document_maybe_done] called with [0x8586f78] document, crash in 3 lines [PageSizer::setDoc] got [0x8586f78] from [0x858be00] SP_ACTIVE_DESKTOP [sp_document_maybe_done] called with [0x8586f78] document, crash in 3 lines [sp_document_maybe_done] called with [0x8586f78] document, crash in 3 lines [PageSizer::setDoc] got [0x8586f78] from [0x858be00] SP_ACTIVE_DESKTOP [sp_document_maybe_done] called with [0x8586f78] document, crash in 3 lines
** ERROR **: file ../../inkscape/src/document-undo.cpp: line 135 (void sp_document_maybe_done(SPDocument*, const gchar*)): assertion failed: (doc->priv->sensitive) aborting...
[CRASH]
-------------------- #0 0xb740d827 in g_logv () from /usr/lib/libglib-2.0.so.0 #1 0xb740dae4 in g_log () from /usr/lib/libglib-2.0.so.0 #2 0xb740db50 in g_assert_warning () from /usr/lib/libglib-2.0.so.0 #3 0x080f3894 in sp_document_maybe_done (doc=Variable "doc" is not available. ) at ../../inkscape/src/document-undo.cpp:135 #4 0x080f38b1 in sp_document_done (doc=0x8586f78) at ../../inkscape/src/document-undo.cpp:118 #5 0x082f588a in Inkscape::UI::Widget::PageSizer::setDoc (this=0x9662b24, w=0, h=-0) at ../../inkscape/src/ui/widget/page-sizer.cpp:294
[...]