Bug 105077 - assertion in SwRegHistory::InsertItems
Summary: assertion in SwRegHistory::InsertItems
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.4.0.0.alpha0+
Hardware: All Linux (All)
: medium normal
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: target:5.4.0 target:5.3.0.2
Keywords: haveBacktrace
Depends on:
Blocks:
 
Reported: 2017-01-03 19:04 UTC by Terrence Enger
Modified: 2017-01-11 14:14 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
gdb on the core file (38.51 KB, text/plain)
2017-01-03 19:07 UTC, Terrence Enger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Terrence Enger 2017-01-03 19:04:43 UTC
Description:
This happened to me as I was trying to reproduce tdf#104920 "Clone
Formatting in Writer Does Not Properly Copy Attributes Sometimes".
Perhaps both bugs come from one cause.

STR
---

(0) Download "Example 1.odt" attached to tdf#104920.

(1) Open "Example 1.odt" from the command line.  Caret is before the
    bullet on the first line

(2) "<right><right><right>".  Caret is after "I".

(3) "<alt>+O C".  Mouse cursor is paint can.

(4) Drag mouse cursor throught the text of second bullet point ("This
    text ... this line.").  The selection is reverse image.

(5) Release mouse button.  Program crashes with error message in
    terminal :

        soffice.bin: /home/terry/lo_hacking/git/libo6/sw/source/core/undo/rolbck.cxx:1328: bool SwRegHistory::InsertItems(const SfxItemSet&, sal_Int32, sal_Int32, SetAttrMode): Assertion `std::find_if( m_pHistory->m_SwpHstry.begin(), m_pHistory->m_SwpHstry.end(), [nExpected](SwHistoryHint *const pHint) -> bool { SwHistoryResetText const*const pReset( dynamic_cast<SwHistoryResetText const*>(pHint)); return pReset && (pReset->GetWhich() == nExpected); }) != m_pHistory->m_SwpHstry.end()' failed.


The backtrace is from local build of commit ae18926c, configured ...
    CC=ccache /usr/bin/gcc
    CXX=ccache /usr/bin/g++
    --enable-option-checking=fatal
    --enable-dbgutil
    --enable-debug
    --without-system-postgresql
    --without-myspell-dicts
    --with-extra-buildid
    --without-doxygen
    --with-external-tar=/home/terry/lo_hacking/git/src
    --without-package-format
built and executed on debian-stretch.


Working in the daily Linux dbgutil bibisect repository, I see that
crash came into LibreOffice on the same day as the menu option Format
> "Clone Formatting", the 86 commits :

          commit    s-h       date
          --------  --------  -------------------
    good  d0d39f17  27ae0020  2016-05-31 01:14:40
    bad   dc618681  cbf36dd4  2016-06-01 00:31:23


I am setting keyword haveBacktrace, and see also tdf#104920.


Steps to Reproduce:
See above

Actual Results:  
Crash.

Expected Results:
I do not know.  This is not a feature that I normally use.


Reproducible: Always

User Profile Reset: No

Additional Info:


User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0
Comment 1 Terrence Enger 2017-01-03 19:07:33 UTC
Created attachment 130121 [details]
gdb on the core file
Comment 2 Buovjaga 2017-01-05 13:13:32 UTC
Repro with attachment 129936 [details] and dbgutil compiled just now.

This only happens with a debug build, so I guess I'll keep priority/severity intact..

Version: 5.4.0.0.alpha0+
Build ID: bfa5bdf415fb9765139cc4d1eb040132ee484946
CPU Threads: 8; OS Version: Linux 4.8; UI Render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Comment 3 Commit Notification 2017-01-10 22:35:39 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=db4badfc971b9cc60809c3408f579bae04a77c34

tdf#105077 sw: fix wrong assert corner-case in SwRegHistory::InsertItems

It will be available in 5.4.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 4 Michael Stahl (allotropia) 2017-01-10 22:36:13 UTC
oh that's a surprising corner case, assertion is wrong then.
Comment 5 Commit Notification 2017-01-11 11:27:33 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=eeb0b8c5fcfcc24b05b773e921b04f3325991247&h=libreoffice-5-3

tdf#105077 sw: fix wrong assert corner-case in SwRegHistory::InsertItems

It will be available in 5.3.0.2.

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

Affected users are encouraged to test the fix and report feedback.
Comment 6 Terrence Enger 2017-01-11 14:14:36 UTC
I no longer see the raised assertion in daily Linux dbgutil bibisect
repository version 2017-01-11.  Thank you, Michael.

However, I see that bug 104920 persists.  Is it possible that the
original assert was right and the calling code is wrong?

Despite this question, I am setting status VERIFIED FIXED.