mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Fix a crash in the URL handling for the dive notes
URLs in the dive notes are detected today. A tooltip is displayed and one can follow the URL by Ctrl-click. In the function fromCursorTilWhitespace there is an issue with incorrect return value of Qt (5.7?!) function cursor->movePosition(). This value is erroneous true in some condition e.g. if the cursor is inside a table at the very beginning or the very end of a table line and not moving any more. This can cause the function end up in an infinite loop. Bugfix adds an additional exit criteria for the loop if the string is not growing any more. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
parent
58a25d33ce
commit
c257144bab
1 changed files with 3 additions and 0 deletions
|
@ -748,6 +748,7 @@ QString TextHyperlinkEventFilter::fromCursorTilWhitespace(QTextCursor *cursor, c
|
|||
QString grownText;
|
||||
QString noSpaces;
|
||||
bool movedOk = false;
|
||||
int oldSize = -1;
|
||||
|
||||
do {
|
||||
result = grownText; // this is a no-op on the first visit.
|
||||
|
@ -759,6 +760,8 @@ QString TextHyperlinkEventFilter::fromCursorTilWhitespace(QTextCursor *cursor, c
|
|||
}
|
||||
|
||||
grownText = cursor->selectedText();
|
||||
if (grownText.size() == oldSize) movedOk = false;
|
||||
oldSize = grownText.size();
|
||||
noSpaces = grownText.simplified().replace(" ", "");
|
||||
} while (grownText == noSpaces && movedOk);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue