@@ -32,6 +32,8 @@ public class Spice.Slide : Object {
3232 public string notes { get ; set ; default = " " ; }
3333 public Gtk . StackTransitionType transition { get ; set ; default = Gtk . StackTransitionType . NONE ; }
3434
35+ private bool is_empty_last_slide = false ;
36+
3537 private Gee . LinkedList<Spice . CanvasItem > to_be_deleted = new Gee .LinkedList<Spice . CanvasItem >();
3638 private bool visible_ = true ;
3739 public bool visible {
@@ -47,10 +49,15 @@ public class Spice.Slide : Object {
4749 item. visible = true ;
4850 }
4951
50- canvas. window. current_file. file_collector. ref_file (thumbnail_file);
52+ if (! is_empty_last_slide) {
53+ canvas. window. current_file. file_collector. ref_file (thumbnail_file);
54+ }
55+
5156 to_be_deleted. clear ();
5257 } else {
53- canvas. window. current_file. file_collector. unref_file (thumbnail_file);
58+ if (! is_empty_last_slide) {
59+ canvas. window. current_file. file_collector. unref_file (thumbnail_file);
60+ }
5461
5562 foreach (var widget in canvas. get_children ()) {
5663 if (widget is CanvasItem && widget. visible) {
@@ -73,6 +80,8 @@ public class Spice.Slide : Object {
7380
7481 public Slide.empty (Spice .Window window ) {
7582 this . save_data = Utils . get_json_object (EMPTY_SLIDE );
83+ is_empty_last_slide = true ;
84+
7685 canvas = new Spice .Canvas (window, save_data);
7786
7887 load_data ();
@@ -116,7 +125,6 @@ public class Spice.Slide : Object {
116125 preview. set_from_pixbuf (pixbuf. scale_simple (SlideList . WIDTH , SlideList . HEIGHT , Gdk . InterpType . BILINEAR ));
117126 }
118127 } else if (save_data. has_member (" thumbnail" )) {
119- print (" Loading thumbnail file...\n " );
120128 var thumbnail_basename = save_data. get_string_member (" thumbnail" );
121129 if (canvas != null && thumbnail_basename != " " ) {
122130 var current_file = canvas. window. current_file;
@@ -127,12 +135,12 @@ public class Spice.Slide : Object {
127135 }
128136 }
129137
130- if (thumbnail_file == null && canvas != null ) {
131- var current_file = canvas. window. current_file;
132- thumbnail_file = current_file. get_random_file_name (current_file. thumbnails_folder, " jpg" );
133- }
138+ if (! is_empty_last_slide && canvas != null ) {
139+ if (thumbnail_file == null ) {
140+ var current_file = canvas. window. current_file;
141+ thumbnail_file = current_file. get_random_file_name (current_file. thumbnails_folder, " jpg" );
142+ }
134143
135- if (canvas != null ) {
136144 canvas. window. current_file. file_collector. ref_file (thumbnail_file);
137145 }
138146
0 commit comments