summaryrefslogtreecommitdiffstats
path: root/src/interface.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2009-06-06 21:41:18 +0000
committerdvlierop2 <dvlierop2@users.sourceforge.net>2009-06-06 21:41:18 +0000
commitfd6bfd8d502572b3629c9a7d6e186cbaf77fe9c7 (patch)
tree7c6de6ea3528574b30b2e479fb2a083a61a12da4 /src/interface.cpp
parentMake sure that when opening a window, this window is positioned within the bo... (diff)
downloadinkscape-fd6bfd8d502572b3629c9a7d6e186cbaf77fe9c7.tar.gz
inkscape-fd6bfd8d502572b3629c9a7d6e186cbaf77fe9c7.zip
When closing a window and while asking whether to save, Inkscape should not be mislead by changing focus to another document (fixes bug #381357)
(bzr r8013)
Diffstat (limited to 'src/interface.cpp')
-rw-r--r--src/interface.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/interface.cpp b/src/interface.cpp
index d628d964d..a751608c5 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -308,13 +308,19 @@ sp_ui_new_view_preview()
void
sp_ui_close_view(GtkWidget */*widget*/)
{
- if (SP_ACTIVE_DESKTOP == NULL) {
+ SPDesktop *dt = SP_ACTIVE_DESKTOP;
+
+ if (dt == NULL) {
return;
}
- if ((SP_ACTIVE_DESKTOP)->shutdown()) {
- return;
+
+ if (dt->shutdown()) {
+ return; // Shutdown operation has been canceled, so do nothing
}
- SP_ACTIVE_DESKTOP->destroyWidget();
+
+ // Shutdown can proceed; use the stored reference to the desktop here instead of the current SP_ACTIVE_DESKTOP,
+ // because the user might have changed the focus in the meantime (see bug #381357 on Launchpad)
+ dt->destroyWidget();
}
@@ -335,11 +341,14 @@ sp_ui_close_all(void)
/* Iterate through all the windows, destroying each in the order they
become active */
while (SP_ACTIVE_DESKTOP) {
- if ((SP_ACTIVE_DESKTOP)->shutdown()) {
- /* The user cancelled the operation, so end doing the close */
+ SPDesktop *dt = SP_ACTIVE_DESKTOP;
+ if (dt->shutdown()) {
+ /* The user canceled the operation, so end doing the close */
return FALSE;
}
- SP_ACTIVE_DESKTOP->destroyWidget();
+ // Shutdown can proceed; use the stored reference to the desktop here instead of the current SP_ACTIVE_DESKTOP,
+ // because the user might have changed the focus in the meantime (see bug #381357 on Launchpad)
+ dt->destroyWidget();
}
return TRUE;