summaryrefslogtreecommitdiffstats
path: root/src/document.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/document.cpp')
-rw-r--r--src/document.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/document.cpp b/src/document.cpp
index 288e52c6d..d406f3712 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -224,6 +224,14 @@ void SPDocument::remove_persp3d (Persp3D * const /*persp*/)
g_print ("Please implement deletion of perspectives here.\n");
}
+void SPDocument::initialize_current_persp3d()
+{
+ this->current_persp3d = persp3d_document_first_persp(this);
+ if (!this->current_persp3d) {
+ this->current_persp3d = persp3d_create_xml_element(this);
+ }
+}
+
unsigned long SPDocument::serial() const {
return priv->serial;
}
@@ -373,11 +381,7 @@ sp_document_create(Inkscape::XML::Document *rdoc,
// Remark: Here, we used to create a "currentpersp3d" element in the document defs.
// But this is probably a bad idea since we need to adapt it for every change of selection, which will
// completely clutter the undo history. Maybe rather save it to prefs on exit and re-read it on startup?
-
- document->current_persp3d = persp3d_document_first_persp(document);
- if (!document->current_persp3d) {
- document->current_persp3d = persp3d_create_xml_element (document);
- }
+ document->initialize_current_persp3d();
sp_document_set_undo_sensitive(document, true);
@@ -730,6 +734,10 @@ SPDocument::emitReconstructionFinish(void)
{
// printf("Finishing Reconstruction\n");
priv->_reconstruction_finish_signal.emit();
+
+ // Reference to the old persp3d object is invalid after reconstruction.
+ initialize_current_persp3d();
+
return;
}
@@ -900,16 +908,16 @@ SPDocument::_updateDocument()
* Repeatedly works on getting the document updated, since sometimes
* it takes more than one pass to get the document updated. But it
* usually should not take more than a few loops, and certainly never
- * more than 32 iterations. So we bail out if we hit 32 iterations,
+ * more than 64 iterations. So we bail out if we hit 64 iterations,
* since this typically indicates we're stuck in an update loop.
*/
gint
sp_document_ensure_up_to_date(SPDocument *doc)
{
- int counter = 32;
+ int counter = 64;
while (!doc->_updateDocument()) {
if (counter == 0) {
- g_warning("More than 32 iteration while updating document '%s'", doc->uri);
+ g_warning("More than 64 iteration while updating document '%s'", doc->uri? doc->uri:"<unknown URI, probably clipboard>");
break;
}
counter--;