summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/browser.c3
-rw-r--r--desktop/gui.h1
-rw-r--r--riscos/window.c16
3 files changed, 20 insertions, 0 deletions
diff --git a/desktop/browser.c b/desktop/browser.c
index 67f43cba2..e6011e2c3 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -209,6 +209,9 @@ void browser_window_open_location_historical(struct browser_window* bw,
assert(bw != 0 && url != 0);
+ /* Check window still exists, if not, don't bother going any further */
+ if (!gui_window_in_list(bw->window)) return;
+
if (bw->url != NULL)
browser_window_destroy(bw, false);
diff --git a/desktop/gui.h b/desktop/gui.h
index 72ead54b4..61b3088b5 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -18,6 +18,7 @@ typedef struct gui_window gui_window;
#include <stdbool.h>
#include "netsurf/desktop/browser.h"
+bool gui_window_in_list(gui_window *g);
gui_window *gui_create_browser_window(struct browser_window *bw);
gui_window *gui_create_download_window(struct content *content);
void gui_window_destroy(gui_window* g);
diff --git a/riscos/window.c b/riscos/window.c
index 01a8a5b96..ed7dddc5b 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -12,6 +12,7 @@
*/
#include <assert.h>
+#include <stdbool.h>
#include <string.h>
#include "oslib/wimp.h"
#include "oslib/wimpspriteop.h"
@@ -24,6 +25,21 @@
gui_window *window_list = 0;
+/**
+ * Checks if a window still exists.
+ */
+bool gui_window_in_list(gui_window *g) {
+
+ gui_window *temp;
+
+ if (g == window_list) return true;
+
+ for(temp=window_list; temp->next != g && temp->next!=0; temp=temp->next) ;
+
+ if (temp->next == NULL) return false;
+
+ return true;
+}
/**
* Create and open a new browser window.