I forgot to check for the empty value in the two conditions, patch re-attached.
Regards, Gehad On Fri, Jan 30, 2015 at 10:47 PM, Miika Turkia <[email protected]> wrote: > On Fri, Jan 30, 2015 at 10:40 PM, Gehad Elrobey <[email protected]> > wrote: > >> The main-tab view is inconsistent as mentioned in #804, this patch fixes >> the notes view. >> > > I get crashes when applying this patch. This occurs when I attempt to > write to the notes field or focus leaves it. > > Program received signal SIGSEGV, Segmentation fault. > __strcmp_ssse3 () at ../sysdeps/x86_64/multiarch/../strcmp.S:209 > 209 ../sysdeps/x86_64/multiarch/../strcmp.S: No such file or directory. > (gdb) bt > #0 __strcmp_ssse3 () at ../sysdeps/x86_64/multiarch/../strcmp.S:209 > #1 0x00000000004ae01e in MainTab::on_notes_textChanged (this=0xb19450) at > ../qt-ui/maintab.cpp:1167 > #2 0x0000000000588299 in MainTab::qt_static_metacall (_o=0xb19450, > _c=QMetaObject::InvokeMetaMethod, _id=14, _a=0x7fffffffcc50) at > .moc/moc_maintab.cpp:237 > #3 0x0000000000588784 in MainTab::qt_metacall (this=0xb19450, > _c=QMetaObject::InvokeMetaMethod, _id=14, _a=0x7fffffffcc50) at > .moc/moc_maintab.cpp:327 > #4 0x00007ffff521636d in QMetaObject::activate(QObject*, int, int, > void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 > > miika > >
From bd6cc3f16a928fe355fa4081edf32a543f2ddb2a Mon Sep 17 00:00:00 2001 From: Gehad elrobey <[email protected]> Date: Fri, 30 Jan 2015 22:27:16 +0200 Subject: [PATCH] Don't go to edit mode if the dive notes field didn't change. The maintab view must be consistent. some fields just go to edit mode whenever they acquire focus and most of them wait till their values are changed. change the dive Notes field to be consistent with the other fields and only enter edit mode if its value is changed. Signed-off-by: Gehad elrobey <[email protected]> commit 2 Signed-off-by: Gehad elrobey <[email protected]> --- qt-ui/maintab.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index c247b77..00702e9 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -1159,9 +1159,13 @@ void MainTab::on_notes_textChanged() if (editMode == IGNORE || acceptingEdit == true) return; if (currentTrip) { + if (displayedTrip.notes && !strcmp(displayedTrip.notes, ui.notes->toPlainText().toUtf8().data())) + return; free(displayedTrip.notes); displayedTrip.notes = strdup(ui.notes->toPlainText().toUtf8().data()); } else { + if (displayed_dive.notes && !strcmp(displayed_dive.notes, ui.notes->toPlainText().toUtf8().data())) + return; free(displayed_dive.notes); if (ui.notes->toHtml().indexOf("<table") != -1) displayed_dive.notes = strdup(ui.notes->toHtml().toUtf8().data()); -- 1.9.1
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
