Commit 3339f7fd authored by Jim Nelson's avatar Jim Nelson

#2179: No longer recurse w/ segfault if go to fullscreen on a photo with no backing file.

parent 8642dd2f
......@@ -149,12 +149,19 @@ public class FullscreenWindow : PageWindow {
hide_toolbar();
toolbar_window = null;
get_current_page().switching_from();
AppWindow.get_instance().end_fullscreen();
}
private override void destroy() {
Page? page = get_current_page();
if (page != null)
page.switching_from();
clear_current_page();
AppWindow.get_instance().end_fullscreen();
base.destroy();
}
private override bool delete_event(Gdk.Event event) {
on_close();
AppWindow.get_instance().destroy();
......@@ -376,7 +383,7 @@ public abstract class PageWindow : Gtk.Window {
}
// AppWindow is the parent window for most windows in Shotwell (FullscreenWindow is the exception).
// There are multiple types of AppWindows (LibraryWindow, EditWindow) for different tasks, but only
// There are multiple types of AppWindows (LibraryWindow, DirectWindow) for different tasks, but only
// one AppWindow may exist per process. Thus, if the user closes an AppWindow, the program exits.
//
// AppWindow also offers support for going into fullscreen mode. It handles the interface
......@@ -641,7 +648,7 @@ public abstract class AppWindow : PageWindow {
FullscreenWindow fsw = new FullscreenWindow(page);
if (get_current_page() != null)
get_current_page().switching_to_fullscreen();
get_current_page().switching_to_fullscreen(fsw);
fullscreen_window = fsw;
fullscreen_window.present();
......@@ -656,13 +663,13 @@ public abstract class AppWindow : PageWindow {
show_all();
if (get_current_page() != null)
get_current_page().returning_from_fullscreen(fullscreen_window);
fullscreen_window.hide();
fullscreen_window.destroy();
fullscreen_window = null;
if (get_current_page() != null)
get_current_page().returning_from_fullscreen();
present();
}
......
......@@ -198,10 +198,10 @@ public abstract class Page : Gtk.ScrolledWindow, SidebarPage {
return in_view;
}
public virtual void switching_to_fullscreen() {
public virtual void switching_to_fullscreen(FullscreenWindow fsw) {
}
public virtual void returning_from_fullscreen() {
public virtual void returning_from_fullscreen(FullscreenWindow fsw) {
}
public void set_item_sensitive(string path, bool sensitive) {
......
......@@ -766,25 +766,27 @@ public abstract class EditingHostPage : SinglePhotoPage {
get_view().clear();
}
public override void switching_to_fullscreen() {
base.switching_to_fullscreen();
public override void switching_to_fullscreen(FullscreenWindow fsw) {
base.switching_to_fullscreen(fsw);
deactivate_tool();
cancel_zoom();
is_pan_in_progress = false;
if (controller != null)
controller.items_selected.connect(on_selection_changed);
Page page = fsw.get_current_page();
if (page != null)
page.get_view().items_selected.connect(on_selection_changed);
}
public override void returning_from_fullscreen() {
base.returning_from_fullscreen();
public override void returning_from_fullscreen(FullscreenWindow fsw) {
base.returning_from_fullscreen(fsw);
repaint();
if (controller != null)
controller.items_selected.disconnect(on_selection_changed);
Page page = fsw.get_current_page();
if (page != null)
page.get_view().items_selected.disconnect(on_selection_changed);
}
private void on_selection_changed(Gee.Iterable<DataView> selected) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment