diff options
-rw-r--r-- | src/narrative_window.c | 1 | ||||
-rw-r--r-- | src/presentation.c | 15 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/narrative_window.c b/src/narrative_window.c index 3f936e0..98001a9 100644 --- a/src/narrative_window.c +++ b/src/narrative_window.c @@ -147,6 +147,7 @@ static gint saveas_response_sig(GtkWidget *d, gint response, show_error(si->nw, _("Failed to save presentation")); } + /* save_presentation keeps a reference to both of these */ g_object_unref(file); g_object_unref(ssfile); diff --git a/src/presentation.c b/src/presentation.c index fd55bf7..28f82a2 100644 --- a/src/presentation.c +++ b/src/presentation.c @@ -110,6 +110,7 @@ static void find_and_load_stylesheet(struct presentation *p, GFile *file) } /* Last resort is NULL stylesheet and SCInterpreter's defaults */ + /* We keep a reference to the GFile */ } @@ -168,6 +169,13 @@ int save_presentation(struct presentation *p, GFile *file, GFile *ssfile) if ( sr ) { fprintf(stderr, _("Couldn't save stylesheet\n")); } + if ( p->stylesheet_from != ssfile ) { + if ( p->stylesheet_from != NULL ) { + g_object_unref(p->stylesheet_from); + } + p->stylesheet_from = ssfile; + g_object_ref(p->stylesheet_from); + } } else { fprintf(stderr, _("Not updating default stylesheet\n")); sr = 0; @@ -176,7 +184,12 @@ int save_presentation(struct presentation *p, GFile *file, GFile *ssfile) if ( r || sr ) return 1; imagestore_set_parent(p->is, g_file_get_parent(file)); - p->file = file; + + if ( p->file != file ) { + if ( p->file != NULL ) g_object_unref(p->file); + p->file = file; + g_object_ref(p->file); + } p->saved = 1; update_titlebar(p->narrative_window); return 0; |