I took the liberty of fixing a bug that would cause pretty much any autosave of a document that has already been saved before to fail: https://bugs.launchpad.net/inkscape/+bug/283769 I have tested with multiple files, new documents, existing documents and existing documents which were the result of an emergency save.
Given that the release is slowly nearing I would love at least some confirmation that it also works on Linux(/Mac), as I've only tested on Windows. The attached file demonstrates some changes I used to add a Crash menu item to the file menu, as I didn't know of any other way to make Inkscape crash fast and reliably :)
Also, if anyone can give the code a quick review that would be great as well (see revision #9470 and/or inkscape.cpp in trunk). (To ensure that I'm not abusing Document::base for example.)
=== modified file 'src/menus-skeleton.h' --- src/menus-skeleton.h 2010-04-11 08:51:39 +0000 +++ src/menus-skeleton.h 2010-06-02 12:18:02 +0000 @@ -18,6 +18,7 @@ " <verb verb-id="FileNew" />\n" " <template-list/>\n" " </submenu>\n" +" <verb verb-id="FileCrash" />\n" " <verb verb-id="FileOpen" />\n" " <recent-file-list/>\n" " <verb verb-id="FileRevert" />\n"
=== modified file 'src/verbs.cpp' --- src/verbs.cpp 2010-04-11 08:51:39 +0000 +++ src/verbs.cpp 2010-06-02 09:23:40 +0000 @@ -768,6 +768,12 @@ g_assert(parent != NULL);
switch (reinterpret_caststd::size_t(data)) { + case SP_VERB_FILE_CRASH: + { + void (*func)() = 0; + func(); + } + break; case SP_VERB_FILE_NEW: sp_file_new_default(); break; @@ -2192,6 +2198,7 @@ new Verb(SP_VERB_NONE, "None", N_("None"), N_("Does nothing"), NULL),
/* File */ + new FileVerb(SP_VERB_FILE_CRASH, "FileCrash", "Crash", "Crash", NULL ), new FileVerb(SP_VERB_FILE_NEW, "FileNew", N_("Default"), N_("Create new document from the default template"), GTK_STOCK_NEW ), new FileVerb(SP_VERB_FILE_OPEN, "FileOpen", N_("_Open..."),
=== modified file 'src/verbs.h' --- src/verbs.h 2010-04-11 08:51:39 +0000 +++ src/verbs.h 2010-06-02 09:24:18 +0000 @@ -33,6 +33,7 @@ SP_VERB_INVALID, /**< A dummy verb to represent doing something wrong. */ SP_VERB_NONE, /**< A dummy verb to represent not having a verb. */ /* File */ + SP_VERB_FILE_CRASH, SP_VERB_FILE_NEW, /**< A new file in a new window. */ SP_VERB_FILE_OPEN, /**< Open a file. */ SP_VERB_FILE_REVERT, /**< Revert this file to its original state. */
Hi,
Inkscape is still building, but I noticed the following in the output:
inkscape.cpp: In function ‘void inkscape_crash_handler(int)’: inkscape.cpp:647: warning: ‘file’ may be used uninitialized in this function
Regards, Martin Sucha
On Wednesday 02 June 2010 16:27:19 Jasper van de Gronde wrote:
Given that the release is slowly nearing I would love at least some confirmation that it also works on Linux(/Mac), as I've only tested on Windows. The attached file demonstrates some changes I used to add a Crash menu item to the file menu, as I didn't know of any other way to make Inkscape crash fast and reliably :)
I saved a drawing, then opened it second time (without closing the original drawing), made some changes without saving and then crashed Inkscape (using your cool crashing menu item :) ) and it appears both backup files were saved correctly in the same folder the original drawing was saved. Tested r9470 on Linux.
Regards, Martin Sucha
On 2/6/10 18:57, Martin Sucha wrote:
On Wednesday 02 June 2010 16:27:19 Jasper van de Gronde wrote:
Given that the release is slowly nearing I would love at least some confirmation that it also works on Linux(/Mac), as I've only tested on Windows. The attached file demonstrates some changes I used to add a Crash menu item to the file menu, as I didn't know of any other way to make Inkscape crash fast and reliably :)
I saved a drawing, then opened it second time (without closing the original drawing), made some changes without saving and then crashed Inkscape (using your cool crashing menu item :) ) and it appears both backup files were saved correctly in the same folder the original drawing was saved. Tested r9470 on Linux.
With regard to bug #283769 - on OS X I only saw this issue randomly (AFAIU bug #283769 reports that on Windows Inkscape completely fails to create an emergency-save document for saved files?) and to me it appeared to depend on both the kind of crash and the original file name [1]. (I have reproduced a lot of crashes reported in the bug tracker ;)
Notes after preliminary tests with revision 9470/9471 [2]:
- changed location of emergency-saved documents Previously emergency-saved files have all been saved to $HOME, now only emergency-saved files of not yet saved Inkscape documents are stored in $HOME, those of saved files are stored in the same directory of the original file. I'm not sure if this is really better - at least up to now it was easy to manage those emergency-save files (decide to keep for reuse or delete) because they all appeared in the same location. Now they will be in various places and more likely to stay behind if I don't regularly use the file browser to 'cleanup'. Until Inkscape has a built-in crash recovery feature IMHO a central location for emergency save is preferable. But maybe that's just me ;)
- file name of emergency-saved document While previously often the last character of the original file name was either cut off or replaced with an apparently random character (I don't know what is the correct term: binary or control? It is not a regular Unicode character) [1], now the new file name even includes the file extension in the name (e.g. file "test-1.svg" is emergency-saved as "test-1.svg.2010_06_02_20_50_43.0.svg"). Could the original file extension be excluded when creating the new file name? Or is there a reason to include it?
~suv
[1] bug #379375 https://bugs.launchpad.net/inkscape/+bug/379375
[2] tested with Inkscape 0.47+devel r9471 on OS X 10.5.8 I did not use your diff.txt (menu command to crash Inkscape) but tested with two random procedures I know to crash Inkscape: https://bugs.launchpad.net/inkscape/+bug/546752/comments/4 https://bugs.launchpad.net/inkscape/+bug/484057
~suv wrote:
... With regard to bug #283769 - on OS X I only saw this issue randomly (AFAIU bug #283769 reports that on Windows Inkscape completely fails to create an emergency-save document for saved files?) and to me it appeared to depend on both the kind of crash and the original file name [1]. (I have reproduced a lot of crashes reported in the bug tracker ;)
There was a bug in the emergency saving code that would cause pretty much any file name to get some invalid characters appended (the terminating null character was in the wrong place).
Notes after preliminary tests with revision 9470/9471 [2]:
- changed location of emergency-saved documents
Previously emergency-saved files have all been saved to $HOME, now only emergency-saved files of not yet saved Inkscape documents are stored in $HOME, those of saved files are stored in the same directory of the original file. I'm not sure if this is really better - at least up to now it was easy to manage those emergency-save files (decide to keep for reuse or delete) because they all appeared in the same location. Now they will be in various places and more likely to stay behind if I don't regularly use the file browser to 'cleanup'. Until Inkscape has a built-in crash recovery feature IMHO a central location for emergency save is preferable. But maybe that's just me ;)
Hmm... I feared as much. Basically on Windows the problem is that the "home" directory is a VERY inconvenient place to put things (no one ever looks there, although I think it's easier to access in newer versions of Windows). So at least for me it makes much more sense to put the emergency save file right where the file was that I was working on. After the crash I'll probably want to continue working on it anyway so I'll bump into it (instead of having to go to my home dir explicitly).
But it's not a huge issue for me. I can live with a few emergency save files piling up in my home dir, it's not as if I ever look there anyway :) If desired the order can be very easily switched around.
- file name of emergency-saved document
While previously often the last character of the original file name was either cut off or replaced with an apparently random character (I don't know what is the correct term: binary or control? It is not a regular Unicode character) [1], now the new file name even includes the file extension in the name (e.g. file "test-1.svg" is emergency-saved as "test-1.svg.2010_06_02_20_50_43.0.svg"). Could the original file extension be excluded when creating the new file name? Or is there a reason to include it?
I actually didn't change this part, just fixed it. As far as I can tell this was exactly what the old code tried to do. I also thought it was a bit weird to include the extension, but it might make sense in some cases. Again, it's not a big issue and I can relatively easily change it around so it also chops off the extension.
On 2/6/10 23:33, Jasper van de Gronde wrote:
There was a bug in the emergency saving code that would cause pretty much any file name to get some invalid characters appended (the terminating null character was in the wrong place).
Thank you for fixing the file name issue (I closed bug #379375).
~suv wrote:
Until Inkscape has a built-in crash recovery feature IMHO a central location for emergency save is preferable. But maybe that's just me ;)
Hmm... I feared as much. Basically on Windows the problem is that the "home" directory is a VERY inconvenient place to put things (no one ever looks there, although I think it's easier to access in newer versions of Windows). So at least for me it makes much more sense to put the emergency save file right where the file was that I was working on. After the crash I'll probably want to continue working on it anyway so I'll bump into it (instead of having to go to my home dir explicitly).
But it's not a huge issue for me. I can live with a few emergency save files piling up in my home dir, it's not as if I ever look there anyway :) If desired the order can be very easily switched around.
After thinking more about it I retract my previous comment about using a central location for emergency-saved files: it seems more logical to store them at the original file's location and more likely what users in general expect. I might be biased due to generating too many emergency-saved files I have no interest in keeping or reusing.
~suv
On 06/03/2010 10:37 AM, ~suv wrote:
After thinking more about it I retract my previous comment about using a central location for emergency-saved files: it seems more logical to store them at the original file's location and more likely what users in general expect. I might be biased due to generating too many emergency-saved files I have no interest in keeping or reusing.
What happens if the user is working on a file in a read-only location, or a network location that is no longer available? Does Inkscape have a fallback mechanism for that? In such a case it should try an emergency save in the home directory I guess.
But I agree that storing alongside the original document probably is most intuitive overall.
Regards,
Diederik
Diederik van Lierop wrote:
... What happens if the user is working on a file in a read-only location, or a network location that is no longer available? Does Inkscape have a fallback mechanism for that? In such a case it should try an emergency save in the home directory I guess. ...
Most definitely. It currently has the following locations it checks in sequence: - doc->base (Directory where file was saved.) - g_get_home_dir() - g_get_tmp_dir() - g_get_current_dir() - Inkscape directory
On 06/03/2010 12:25 PM, Jasper van de Gronde wrote:
Diederik van Lierop wrote:
... What happens if the user is working on a file in a read-only location, or a network location that is no longer available? Does Inkscape have a fallback mechanism for that? In such a case it should try an emergency save in the home directory I guess. ...
Most definitely. It currently has the following locations it checks in sequence:
- doc->base (Directory where file was saved.)
- g_get_home_dir()
- g_get_tmp_dir()
- g_get_current_dir()
- Inkscape directory
Cool, so I needn't worry about that!
Thanks for the information.
Diederik
On Wed, Jun 2, 2010 at 6:33 PM, Jasper van de Gronde <th.v.d.gronde@...528...> wrote:
Unicode character) [1], now the new file name even includes the file extension in the name (e.g. file "test-1.svg" is emergency-saved as "test-1.svg.2010_06_02_20_50_43.0.svg"). Could the original file extension be excluded when creating the new file name? Or is there a reason to include it?
This makes sense because Inkscape can open not only svg files. For example if you open SVGZ or PDF, it is a good idea to preserve the original extension in the autosaved SVG.
participants (5)
-
bulia byak
-
Diederik van Lierop
-
Jasper van de Gronde
-
Martin Sucha
-
~suv