[dia] Bug 614278 - Only remove the active layer on load of initial diagram
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] Bug 614278 - Only remove the active layer on load of initial diagram
- Date: Sun, 30 Jan 2011 15:44:14 +0000 (UTC)
commit 3e42f741f68260b31ae266aef49f6f1b0dc47f29
Author: Hans Breuer <hans breuer org>
Date: Sun Jan 30 15:08:34 2011 +0100
Bug 614278 - Only remove the active layer on load of initial diagram
An important invariant of DiagramData::active_layer is it being always
valid. As a result the initial object can not be created without a layer,
but that layer gets replaced when laoding a diagram.
Now with real load-into as in dropping another diagram/file into an
existing one this would destroy part of the diagram to preserve. So the
unusual side-effect of diagram_data_load() is restricted to the case
described above.
app/load_save.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/app/load_save.c b/app/load_save.c
index 4de4954..a2fe830 100644
--- a/app/load_save.c
+++ b/app/load_save.c
@@ -418,9 +418,11 @@ diagram_data_load(const char *filename, DiagramData *data, void* user_data)
}
/* Destroy the default layer: */
- g_ptr_array_remove(data->layers, data->active_layer);
- layer_destroy(data->active_layer);
-
+ if (layer_object_count(data->active_layer) == 0) {
+ g_ptr_array_remove(data->layers, data->active_layer);
+ layer_destroy(data->active_layer);
+ }
+
diagramdata =
find_node_named (doc->xmlRootNode->xmlChildrenNode, "diagramdata");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]