From 12a29c68bfc789119426d3f3a39df3abe73fcee3 Mon Sep 17 00:00:00 2001 From: joncruz Date: Thu, 12 Jun 2008 09:49:31 +0000 Subject: [PATCH] Fixed uninitialized variables, including modified-since-save. --- src/document.cpp | 45 +++++++++++++++++++++------------------------ src/document.h | 6 +++--- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/src/document.cpp b/src/document.cpp index 333ce8d5a..af65d2d30 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -77,33 +77,30 @@ static gint doc_count = 0; static unsigned long next_serial = 0; -SPDocument::SPDocument() { - SPDocumentPrivate *p; - - keepalive = FALSE; - virgin = TRUE; - - modified_id = 0; - - rdoc = NULL; - rroot = NULL; - root = NULL; - style_cascade = cr_cascade_new(NULL, NULL, NULL); - - uri = NULL; - base = NULL; - name = NULL; - - _collection_queue = NULL; - - // Initialise instance of connector router. - router = new Avoid::Router(); +SPDocument::SPDocument() : + keepalive(FALSE), + virgin(TRUE), + modified_since_save(FALSE), + rdoc(0), + rroot(0), + root(0), + style_cascade(cr_cascade_new(NULL, NULL, NULL)), + uri(0), + base(0), + name(0), + priv(0), // reset in ctor + actionkey(0), + modified_id(0), + profileManager(0), // deferred until after other initialization + router(new Avoid::Router()), + perspectives(0), + current_persp3d(0), + _collection_queue(0) +{ // Don't use the Consolidate moves optimisation. router->ConsolidateMoves = false; - perspectives = NULL; - - p = new SPDocumentPrivate(); + SPDocumentPrivate *p = new SPDocumentPrivate(); p->serial = next_serial++; diff --git a/src/document.h b/src/document.h index b0d6afecb..a5cc3b855 100644 --- a/src/document.h +++ b/src/document.h @@ -108,6 +108,8 @@ struct SPDocument : public Inkscape::GC::Managed<>, Persp3D *current_persp3d; // "currently active" perspective (e.g., newly created boxes are attached to this one) + GSList *_collection_queue; + void add_persp3d (Persp3D * const persp); void remove_persp3d (Persp3D * const persp); @@ -130,8 +132,6 @@ sigc::connection connectCommit(CommitSignal::slot_type slot); void _emitModified(); - GSList *_collection_queue; - void addUndoObserver(Inkscape::UndoStackObserver& observer); void removeUndoObserver(Inkscape::UndoStackObserver& observer); @@ -141,7 +141,7 @@ sigc::connection connectCommit(CommitSignal::slot_type slot); bool isSeeking() const; bool isModifiedSinceSave() const { return modified_since_save; } - void setModifiedSinceSave(bool modified=true) { + void setModifiedSinceSave(bool modified = true) { modified_since_save = modified; } -- 2.30.2