[dia] diagram-as-element: no dangling filename with DiaImage
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] diagram-as-element: no dangling filename with DiaImage
- Date: Sun, 26 Jun 2011 14:34:05 +0000 (UTC)
commit 9c016cd0eb47fc51fb197131fb37bfb15fd7712c
Author: Hans Breuer <hans breuer org>
Date: Sun Jun 26 16:29:51 2011 +0200
diagram-as-element: no dangling filename with DiaImage
Don't expose the side-effect of saving to a temporary file.
That file is already gone when DiaRenderer::draw_image() is
called.
objects/Misc/diagram_as_object.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/objects/Misc/diagram_as_object.c b/objects/Misc/diagram_as_object.c
index 987a3a6..aa26437 100644
--- a/objects/Misc/diagram_as_object.c
+++ b/objects/Misc/diagram_as_object.c
@@ -208,9 +208,15 @@ _dae_draw(DiagramAsElement *dae, DiaRenderer *renderer)
ef = filter_guess_export_filter (imgfname);
close(fd);
if (ef) {
+ DiaImage *tmp_image;
ef->export_func (dae->data, imgfname, dae->filename, ef->user_data);
/* TODO: change export_func to return success or GError* */
- dae->image = dia_image_load (imgfname);
+ tmp_image = dia_image_load (imgfname);
+ /* some extra gymnastics to create an image w/o filename */
+ if (tmp_image) {
+ dae->image = dia_image_new_from_pixbuf ((GdkPixbuf *)dia_image_pixbuf (tmp_image));
+ g_object_unref (tmp_image);
+ }
}
g_unlink (imgfname);
g_free (imgfname);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]