Skip to content

Commit 91c8565

Browse files
committed
be more careful about temp delete
libvips can change ->filename behind our back, have our own filename
1 parent f02aba9 commit 91c8565

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ started 8.3.1 on 19/5/16
22
- disable debug by default, thanks Benjamin
33
- configure changes to help win64
44
- fix middle-drag in ws and image view
5+
- be more careful about the name of the image file we remove on close
56

67
started 8.3.0 on 28/3/16
78
- move path search stuff into _convert from _magick

src/imageinfo.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,11 +492,15 @@ imageinfo_finalize( GObject *gobject )
492492
IM_FREEF( im_close, imageinfo->mapped_im );
493493
IM_FREEF( im_close, imageinfo->identity_lut );
494494

495-
if( imageinfo->dfile && isfile ) {
496-
unlinkf( "%s", name );
495+
if( imageinfo->dfile &&
496+
imageinfo->delete_name &&
497+
isfile ) {
498+
unlinkf( "%s", imageinfo->delete_name );
497499
iobject_changed( IOBJECT( main_imageinfogroup ) );
498500
}
499501

502+
VIPS_FREE( imageinfo->delete_name );
503+
500504
MANAGED_UNREF( imageinfo->underlying );
501505

502506
imageinfo_undo_free( imageinfo );
@@ -626,6 +630,7 @@ imageinfo_init( Imageinfo *imageinfo )
626630
imageinfo->proxy = NULL;
627631

628632
imageinfo->dfile = FALSE;
633+
imageinfo->delete_name = NULL;
629634
imageinfo->from_file = FALSE;
630635
imageinfo->mtime = 0;
631636
imageinfo->exprs = NULL;
@@ -812,6 +817,7 @@ imageinfo_new_temp( Imageinfogroup *imageinfogroup,
812817
return( NULL );
813818
}
814819
imageinfo->dfile = TRUE;
820+
VIPS_SETSTR( imageinfo->delete_name, tname );
815821

816822
return( imageinfo );
817823
}

src/imageinfo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ struct _Imageinfo {
121121
Imageinfoproxy *proxy; /* Proxy for IMAGE callbacks */
122122

123123
gboolean dfile; /* delete_file on final close */
124+
char *delete_name; /* the filename we unlink */
124125

125126
gboolean from_file; /* Set if ->name is a user file */
126127
time_t mtime; /* What mtime was when we loaded this file */

src/ip.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ extern int statfs();
147147
#include <goffice/graph/gog-legend.h>
148148
#include <goffice/graph/gog-chart-map.h>
149149

150-
#include <goffice/gtk/go-graph-widget.h>
151150

152151
#include <goffice/utils/go-color.h>
153152
#include <goffice/utils/go-marker.h>

0 commit comments

Comments
 (0)