GNOME Bugzilla – Bug 779979
todo.txt doesn't create the source file if it has been deleted.
Last modified: 2017-03-29 21:44:08 UTC
Steps to reproduce. 1) Select some todo.txt in To Do. 2) Close To Do and then delete the todo.txt selected. 3) Open To Do. Todo gives an error as although the source uri is still stored but the file doesn't exist. Possible Solution: Check whether todo.txt file actually exist if not create it.
Created attachment 347838 [details] [review] Todo.txt plugin: Create the source file if it is deleted This fixes the issue if the source_file that is being used is deleted by the user when ToDo is not running, in which case earlier would have given an error as although the source contains the uri to the file but the file is now present at the location. The fix is to check if file exists and if not create one.
Review of attachment 347838 [details] [review]: Looks good.
Created attachment 348211 [details] [review] todo-txt: create source file if it is deleted This fixes the issue if the source_file that is being used is deleted by the user when To Do is not running, in which case earlier would have given an error as although the source contains the uri to the file but the file is now present at the location. The fix is to check if file exists and if not create one.
Comment on attachment 348211 [details] [review] todo-txt: create source file if it is deleted I rewrote the commit message. Please try to follow this style next time.
Attachment 348211 [details] pushed as 2369228 - todo-txt: create source file if it is deleted
Created attachment 348605 [details] [review] todo.txt-plugin: Handle user deletion of todo.txt while To Do is running Deletion of todo.txt by user while To Do is running causes a segmentation fault error. The problem is G_FILE_MONITOR_EVENT_DELETED was not handled separately in the gtd_plugin_todo_txt_monitor_source which causes issue as source_file doesn't points to a valid file as it has been deleted by user. The fix is handled G_FILE_MONITOR_EVENT_DELETED handle separately and create a new file at same path as earlier and assign it to source_file.
Review of attachment 348605 [details] [review]: LGTM (and the commit message is fine!)
Thanks for the patch.