SF.net SVN: geany:[4501] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Sun Dec 20 20:29:45 UTC 2009
Revision: 4501
http://geany.svn.sourceforge.net/geany/?rev=4501&view=rev
Author: eht16
Date: 2009-12-20 20:29:45 +0000 (Sun, 20 Dec 2009)
Log Message:
-----------
Mark the document only as changed if it is not closed afterwards.
Prevent possible segfaults if the document was closed when it is missing from the filesystem.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/document.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-12-20 20:07:52 UTC (rev 4500)
+++ trunk/ChangeLog 2009-12-20 20:29:45 UTC (rev 4501)
@@ -12,6 +12,9 @@
* src/document.c:
When closing a document after it was deleted from the filesystem,
don't ask whether it should be saved first.
+ Mark the document only as changed if it is not closed afterwards.
+ Prevent possible segfaults if the document was closed when it is
+ missing from the filesystem.
* src/keybindings.c, src/keyfile.c, src/main.c, src/msgwindow.c,
src/msgwindow.h, src/prefs.c:
Add MessageWindow::scribble and use it instead of searching the
Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c 2009-12-20 20:07:52 UTC (rev 4500)
+++ trunk/src/document.c 2009-12-20 20:29:45 UTC (rev 4501)
@@ -2948,11 +2948,6 @@
gboolean want_reload = FALSE;
gint ret;
- /* file is missing - set unsaved state */
- document_set_text_changed(doc, TRUE);
- /* don't prompt more than once */
- setptr(doc->real_path, NULL);
-
ret = dialogs_show_prompt(NULL,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@@ -2966,9 +2961,15 @@
}
else if (ret == GTK_RESPONSE_CLOSE)
{
- doc->changed = FALSE;
document_close(doc);
}
+ if (ret != GTK_RESPONSE_CLOSE)
+ {
+ /* file is missing - set unsaved state */
+ document_set_text_changed(doc, TRUE);
+ /* don't prompt more than once */
+ setptr(doc->real_path, NULL);
+ }
return want_reload;
}
@@ -3027,11 +3028,13 @@
}
g_free(locale_filename);
- old_status = doc->priv->file_disk_status;
- doc->priv->file_disk_status = FILE_OK;
- if (old_status != doc->priv->file_disk_status)
- ui_update_tab_status(doc);
-
+ if (DOC_VALID(doc))
+ { /* doc can get invalid when a document was closed by monitor_resave_missing_file() */
+ old_status = doc->priv->file_disk_status;
+ doc->priv->file_disk_status = FILE_OK;
+ if (old_status != doc->priv->file_disk_status)
+ ui_update_tab_status(doc);
+ }
return ret;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list