Page 1 of 1

Crash after deleting note

Posted: Wed Oct 22, 2014 7:04 am
by Thomas Lohrum
I think this is a regression. When you delete a note from the notes list, for which a editor window is open, the editor remains open. It should close, when the note gets deleted. When you switch back to the notes and press ESC it will create a new note. When you go back and press Ctrl+Del instead it will crash with the following error:

---------------------------
Error
---------------------------
class err::LogicException
Postcondition failed:
app::model::data::NoteMapper::getNote
n
---------------------------
OK
---------------------------


Thomas


[log.1.txt]
Timestamp Thread Forced Function Details
8:57:57.354384 3356 logging::Log::init Started logging
8:57:57.354384 3356 X ui::wndProc ERROR:class err::LogicException
Postcondition failed:
app::model::data::NoteMapper::getNote
n

Re: Crash after deleting note

Posted: Wed Oct 22, 2014 10:41 am
by CintaNotes Developer
Hi Thomas,
Thanks for the report!

I've just tested and it seems that the problem was always present (at least since CintaNotes 2.3), although in a slightly different form:
Ctrl+Del in the editor did nothing, and second Ctrl+Del displayed "Can't start a transaction within a transaction" message.

I also don't quite agree that the dialog should immediately close. I think this should be the case only if there are no unsaved changes, otherwise the dialog should remain open, and work as if the edited note was a new note. What do you think?

Re: Crash after deleting note

Posted: Wed Oct 22, 2014 3:03 pm
by Thomas Lohrum
Alex,

i remember we had a similar talk before, but don't remember the details. I don't want to stress this issue. Either way is ok. So yes, saving the (just deleted) note, in case there are unsaved changes is one of the possibilities. In the end it is most important not to crash, whatever the solution is. ;)

Thomas

Re: Crash after deleting note

Posted: Thu Oct 23, 2014 9:53 am
by CintaNotes Developer
The easiest solution would be just to disable Ctrl+Del for notes which don't exist in the database.

Re: Crash after deleting note

Posted: Thu Oct 23, 2014 10:11 am
by Thomas Lohrum
CintaNotes Developer wrote:The easiest solution would be just to disable Ctrl+Del for notes which don't exist in the database.

In that case any already opened editor needed to be notified about any deletion to check it might be affected.

Thomas

Re: Crash after deleting note

Posted: Thu Oct 23, 2014 10:19 am
by CintaNotes Developer
No need - it should just check if the note is still in the db upon Ctrl+Del press

Re: Crash after deleting note

Posted: Thu Oct 23, 2014 12:08 pm
by Thomas Lohrum
CintaNotes Developer wrote:No need - it should just check if the note is still in the db upon Ctrl+Del press

Ok, so it is not about disabling the shortcut, but ignoring it instead. ;) However, will the user understand that pressing the key - all the sudden - does not react? After all the user already deleted the note from the list, then realizes it is still there (in the open editor) and tries to eventually get rid of it! That is why i argued that the editor should be closed, when the note gets deleted from the list. Regardless of any changes.

Thomas

Re: Crash after deleting note

Posted: Fri Oct 24, 2014 8:05 am
by CintaNotes Developer
Thomas Lohrum wrote:Ok, so it is not about disabling the shortcut, but ignoring it instead. ;) However, will the user understand that pressing the key - all the sudden - does not react? After all the user already deleted the note from the list, then realizes it is still there (in the open editor) and tries to eventually get rid of it! That is why i argued that the editor should be closed, when the note gets deleted from the list


Probably then the best solution would be to close the editor, but if there are any unsaved changes display an additional warning?

Re: Crash after deleting note

Posted: Fri Oct 24, 2014 9:56 am
by Thomas Lohrum
CintaNotes Developer wrote:Probably then the best solution would be to close the editor, but if there are any unsaved changes display an additional warning?

I guess you mean something like "This note does contain unsaved changes. Are you sure you want to delete it?"

Thomas

Re: Crash after deleting note

Posted: Sat Oct 25, 2014 4:05 am
by CintaNotes Developer
Thomas Lohrum wrote:I guess you mean something like "This note does contain unsaved changes. Are you sure you want to delete it?"

Yes, exactly. Before CN deletes any notes, it will run through all notes that are currently open in the editor, and if they have unsaved changes, it will ask for additional confirmation.

Another option that is probably less bothering for the user is to silently save the changes and move the note to the Recycle Bin (even when Shift+Del was pressed).

We need to decide which one is better:)

Re: Crash after deleting note

Posted: Sat Oct 25, 2014 6:29 pm
by Thomas Lohrum
CintaNotes Developer wrote:
Thomas Lohrum wrote:I guess you mean something like "This note does contain unsaved changes. Are you sure you want to delete it?"
Yes, exactly. Before CN deletes any notes, it will run through all notes that are currently open in the editor, and if they have unsaved changes, it will ask for additional confirmation. Another option that is probably less bothering for the user is to silently save the changes and move the note to the Recycle Bin (even when Shift+Del was pressed). We need to decide which one is better:)

Alex,

i like your idea of taking care of the issue silently. However i have just tested what happens when i try to delete a changed note in the editor. A dialog warns me about the change and asks whether i really want to discard the changes. Thus it makes sense to ask for confirmation. First it matches the behaviour inside the editor. Second it also handles the issue, when Shift+Del was pressed. Btw. currently deleting a note from inside the editor will always move it to recycle bin. Personally i don't care. I've just got aware of this inconsistency. On the other hand the different shortcuts to delete a note (Del, Ctrl+Del) are a inconsistency on their own.

Thomas

Re: Crash after deleting note

Posted: Mon Oct 27, 2014 8:26 am
by CintaNotes Developer
Hi Thomas,
Thomas Lohrum wrote:Thus it makes sense to ask for confirmation.


I guess you're right, thanks. I've planned the fix for this for version 2.8.2 (did not make it into 2.8.1).

About the inconsistency - I'm afraid there will be no way to get rid of it, because using simple Del
to delete notes in the notes list is very convenient, however out of the question for the editor.