Fix bug #3159040: make destruction order of browser_window objects sane

svn path=/trunk/netsurf/; revision=11345
This commit is contained in:
John Mark Bell 2011-01-17 08:28:22 +00:00
parent fbbfb2a75f
commit 1034f16f0b

View File

@ -989,6 +989,20 @@ void browser_window_destroy_internal(struct browser_window *bw)
if (bw->children != NULL || bw->iframes != NULL)
browser_window_destroy_children(bw);
schedule_remove(browser_window_refresh, bw);
/* Destruction order is important: we must ensure that the frontend
* destroys any window(s) associated with this browser window before
* we attempt any destructive cleanup.
*
* Additionally, we must destroy any selection and history before
* releasing the handle to any content objects this window is using.
*/
gui_window_destroy(bw->window);
selection_destroy(bw->sel);
history_destroy(bw->history);
if (bw->loading_content != NULL) {
hlcache_handle_release(bw->loading_content);
bw->loading_content = NULL;
@ -1004,12 +1018,6 @@ void browser_window_destroy_internal(struct browser_window *bw)
bw->current_content = NULL;
}
schedule_remove(browser_window_refresh, bw);
selection_destroy(bw->sel);
history_destroy(bw->history);
gui_window_destroy(bw->window);
free(bw->name);
free(bw->frag_id);
free(bw->status_text);