Bug 141499 - Crash inserting hyperlink (fairly often) and cursor not starting in URL field
Summary: Crash inserting hyperlink (fairly often) and cursor not starting in URL field
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.2.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:7.2.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2021-04-05 16:47 UTC by Justin L
Modified: 2021-05-01 13:16 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
130056_hyperlink.odt (14.21 KB, application/vnd.oasis.opendocument.text)
2021-04-05 16:47 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin L 2021-04-05 16:47:43 UTC
Created attachment 170967 [details]
130056_hyperlink.odt

Both the crashing and the cursor not starting in the URL field when inserting a hyperlink started at the same 7.2 commit.

commit 9ffd28c32a301141a26e41ddd0cf485a562c83bb
Author: Caolán McNamara on Fri Mar 5 16:13:19 2021 +0000
    use container_focus_changed instead of toplevel_focus_changed
    
    seeing as its the same thing, but available one level of
    inheritance down

The crashing part seems to be here (and avoided by the indicated diff marks):
void SfxModelessDialogController::Activate()
{
    if (!m_xImpl)
        return;
+    if (!m_xImpl->pMgr)
+       return;

    m_pBindings->SetActiveFrame(m_xImpl->pMgr->GetFrame());

Steps to (fairly reliably) reproduce
1.) open 130056_hyperlink.odt.
2.) highlight any word ("Internet") and press Ctrl-K (insert hyperlink).  Notice that the cursor is NOT waiting for you to start typing. It was nicer before the identified commit.
3.) type a URL ("junk") and hit enter.
Frequently at this point LO will crash and start program recovery.
Comment 1 Caolán McNamara 2021-04-05 18:48:49 UTC
The crash is (presumably) gone since https://cgit.freedesktop.org/libreoffice/core/commit/?id=82f473c87da72a3d7aac80249d408a02caa25afa
Comment 2 Caolán McNamara 2021-04-05 19:30:43 UTC
https://gerrit.libreoffice.org/c/core/+/113616 should make this detect the toplevel window gaining focus again the way it used to.
Comment 3 Commit Notification 2021-04-05 19:46:05 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/30507382e11e2340c7dee7adced1f5f37a2d9e7f

Related: tdf#141499 don't grab focus during teardown of dialog

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Commit Notification 2021-04-05 20:21:27 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c7cfd3323cf80d5953f5c3808c1afd6fec0c674b

tdf#141499 trigger container_focus_changed for toplevel window focus events

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.