Created attachment 199272 [details] Character Styles inherit from Strong Emphasis resp. MyEmphasis PRECONDITION: (see attached MyCharacterStyle.odt) example inherits from standard style: New Style myStrong Inherit from Strong Emphasis used by 1st text line in document another example which inherits from Custom Style: New Style MyEmphasis Inherit from Emphasis used by 2nd text line in document New Style MyEmphasis2 Inherit from MyEmphasis used by 3rd text line in document PROBLEM DESCRIPTION: (see attached MyCharacterStyleDel.odt after deleting both) Delete custom style myStrong ==> text does not revert to inherit-from-style Strong Emphasis Delete custom style MyEmphasis2 ==> text does not revert to inherit-from-style MyEmphasis see style.xml the deleted styles are removed see content.xml: the removed styles are still used <text:span text:style-name="myStrong"> <text:span text:style-name="MyEmphasis2"> EXPECTED BEHAVIOR: styles will revert to the parent style <text:span text:style-name="Strong_20_Emphasis"> (1st line) resp. <text:span text:style-name="MyEmphasis"> (3rd line) (works fine with Paragraph Styles) Version: 24.8.4.2 (X86_64) / LibreOffice Community Build ID: bb3cfa12c7b1bf994ecc5649a80400d06cd71002 CPU threads: 2; OS: Linux 6.8; UI render: default; VCL: gtk3 Locale: de-DE (de_DE.UTF-8); UI: en-US Calc: threaded
Created attachment 199273 [details] styles myStrong and MyEmphasis2 deleted but still used in content
The warning text when deleting the character style is, "One or more of the selected styles is in use in this document. If you will delete it, text or objects using these styles will revert to the parent style. Do you still wish to delete these styles?" When you have deleted the style the text portion still shows the color from the now deleted style. It does not show the color of the parent. Reverting to the parent styles does not happen. If you use the Style Inspector with this portion of text, LibreOffice crashes. (Click on different portions of the text and then back to the affected one.) An immediate save after deleting the character style has the no longer existing style referenced in the markup of the text portion, as described by the reporter. Tested with Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 85c8901dc2710e91bccb64cd7d8068441f42f65b CPU threads: 32; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Vulkan; VCL: win Locale: de-DE (de_DE); UI: en-US Calc: threaded It was OK in Version: 7.6.4.1 (X86_64) / LibreOffice Community Build ID: e19e193f88cd6c0525a17fb7a176ed8e6a3e2aa1 CPU threads: 32; OS: Windows 10.0 Build 26100; UI render: Skia/Vulkan; VCL: win Locale: de-DE (de_DE); UI: en-US Calc: threaded
Bibisected with linux-64-24.8 commit 23829f6e1cebf808f4e6ff6ed4856123ad8e8e38 author Patrick Luby <guibmacdev@gmail.com> tdf#140061 keep SwCharFormat instances alive while SwDoc is alive Change-Id: I22a7fc1e109e641932f348e9ac3b85f11ce46c9d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171608
Causes data loss that may not be realized until too late.
(In reply to Saburo from comment #3) > Bibisected with linux-64-24.8 > commit 23829f6e1cebf808f4e6ff6ed4856123ad8e8e38 > author Patrick Luby <guibmacdev@gmail.com> > > tdf#140061 keep SwCharFormat instances alive while SwDoc is alive > > Change-Id: I22a7fc1e109e641932f348e9ac3b85f11ce46c9d > Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171608 So I created the following patch that reverts the above commit: https://gerrit.libreoffice.org/c/core/+/183468 The good news is that reverting the commit does *not* cause tdf#140061 to reappear. The bad news is that now I see a crash when deleting a custom style in attachment #199272 [details]. While I wish I could help, I am not familiar with the Writer code so when I tried to fix tdf#140061, I just delayed deletion of the custom style's memory and it appears that this bug also needs the same delayed deletion as well. Maybe the Writer developers know some way to "unlink" whatever code is holding on to the custom style's memory.
Created attachment 200071 [details] Sample of LibreOffice master build at crash This crash log was captured while using the following patch in my local master macOS build. Don't know if this is useful data, but the crash occurs in lcl_MergeAttr_ExpandChrFormat(): https://gerrit.libreoffice.org/c/core/+/183468
*** Bug 164370 has been marked as a duplicate of this bug. ***