Bug Report Q485875
Visible to All Users

Styles - Application crashes when trying to modify newly added CharacterStyle twice

created 12 years ago

Hello,

I have an issue with the RichEdit Control. You can do the following to reproduce.

  1. Add this method to the Styles.cs in the RichEditMainDemo sample:
C#
private static void AddStyles(RichEditControl richEditControl) { CharacterStyle cstyle = richEditControl.Document.CharacterStyles["My Heading 1"]; if (cstyle == null) { cstyle = richEditControl.Document.CharacterStyles.CreateNew(); cstyle.Name = "My Heading 1"; richEditControl.Document.CharacterStyles.Add(cstyle); CharacterStyle parentStyle = richEditControl.Document.CharacterStyles["Default Paragraph Font"]; if (parentStyle != null) { cstyle.Parent = parentStyle; } cstyle.Bold = true; //cstyle.Italic = cstyle.FontSize = 36; } }
  1. Now call this method in the DoShow() Method and you have now created a new style created "My Heading 1".
  2. Run the sample and select Styles (updated) and verify that you have a new style called "My Heading 1" in the Styles gallery
  3. Mark some text and apply the new style.
  4. Modify the "My Heading 1" style in the Modify Style dialog. For example change the font size. and close the dialog.
  5. Now try to modify the style again and the demo crashes. I wither shuts down with no stack trace or it closes with following stack trace.
C#
at DevExpress.XtraRichEdit.Model.CharacterProperties.GetCache(DocumentModel documentModel) at DevExpress.XtraRichEdit.Model.RichEditIndexBasedObject`1.GetCache(IDocumentModel documentModel) at DevExpress.Office.UndoableIndexBasedObject`2.get_InfoCore() at DevExpress.Office.UndoableIndexBasedObject`2.get_Info() at DevExpress.XtraRichEdit.Model.CharacterPropertiesMerger..ctor(CharacterProperties initialProperties) at DevExpress.XtraRichEdit.Model.CharacterStyle.GetMergedCharacterProperties() at DevExpress.XtraRichEdit.Model.CharacterStyle.GetMergedCharacterProperties() at DevExpress.XtraRichEdit.Model.TextRunBase.GetParentMergedCharacterProperties() at DevExpress.XtraRichEdit.Model.TextRunBase.GetMergedCharacterProperties() at DevExpress.XtraRichEdit.Model.TextRunBase.get_MergedCharacterFormattingCacheIndex() at DevExpress.XtraRichEdit.Model.TextRunBase.get_MergedCharacterFormatting() at DevExpress.XtraRichEdit.Model.VisibleTextFilter.IsRunVisibleCore(RunIndex runIndex) at DevExpress.XtraRichEdit.Model.VisibleTextFilter.IsRunVisible(RunIndex runIndex) at DevExpress.XtraRichEdit.Model.VisibleTextFilterBase.FindVisibleParagraphRunForward(RunIndex runIndex) at DevExpress.XtraRichEdit.Layout.Engine.ParagraphIteratorBase..ctor(Paragraph paragraph, PieceTable pieceTable, IVisibleTextFilter visibleTextFilter) at DevExpress.XtraRichEdit.Layout.Engine.BeginParagraphFormatting.EnsureParagraphBoxes() at DevExpress.XtraRichEdit.Layout.Engine.BeginParagraphFormatting.FormatNextRow() at DevExpress.XtraRichEdit.Layout.Engine.DocumentFormatter.FormatNextRow() at DevExpress.XtraRichEdit.Layout.Engine.BackgroundFormatter.PerformPrimaryLayoutCore() at DevExpress.XtraRichEdit.Layout.Engine.BackgroundFormatter.PerformPrimaryLayout() at DevExpress.XtraRichEdit.Layout.Engine.BackgroundFormatter.PerformSecondaryLayout() at DevExpress.XtraRichEdit.Layout.Engine.BackgroundFormatter.HandleCommand(Int32 commandIndex) at DevExpress.XtraRichEdit.Layout.Engine.BackgroundFormatter.HandleCommand(WeakReference thisWeakRef, Int32 commandIndex) at DevExpress.XtraRichEdit.Layout.Engine.BackgroundFormatter.WorkerBody(WeakReference thisWeakRef) at DevExpress.XtraRichEdit.Layout.Engine.BackgroundFormatter.Worker(Object parameter) at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart(Object obj)

I have also seen the following stack track which is almost identical:

C#
at DevExpress.XtraRichEdit.Model.CharacterProperties.GetCache(DocumentModel documentModel) at DevExpress.XtraRichEdit.Model.RichEditIndexBasedObject`1.GetCache(IDocumentModel documentModel) at DevExpress.Office.IndexBasedObjectA`2.get_InfoCore() at DevExpress.Office.IndexBasedObjectA`2.get_Info() at DevExpress.XtraRichEdit.Model.CharacterPropertiesMerger..ctor(CharacterProperties initialProperties) at DevExpress.XtraRichEdit.Model.CharacterStyle.GetMergedCharacterProperties() at DevExpress.XtraRichEdit.Model.CharacterStyle.GetMergedCharacterProperties() at DevExpress.XtraRichEdit.Model.CharacterStyle.GetMergedWithDefaultCharacterProperties() at DevExpress.XtraRichEdit.Model.CharacterStyle.CopyFrom(DocumentModel targetModel) at DevExpress.XtraRichEdit.Model.CharacterStyle.Copy(DocumentModel targetModel) at DevExpress.XtraRichEdit.Forms.EditStyleFormController.FillTempRichEdit(IRichEditControl richEditControl) at DevExpress.XtraRichEdit.Forms.EditStyleForm.InitializeForm() at DevExpress.XtraRichEdit.Forms.EditStyleForm.cbCurrentStyle_SelectedIndexChanged(Object sender, EventArgs e) at DevExpress.XtraEditors.Repository.RepositoryItemComboBox.RaiseSelectedIndexChanged(EventArgs e) at DevExpress.XtraEditors.ComboBoxEdit.UpdatePopupEditValueIndex(Int32 prevIndex) at DevExpress.XtraEditors.ComboBoxEdit.set_EditValue(Object value) at DevExpress.XtraEditors.PopupBaseEdit.AcceptPopupValue(Object val) at DevExpress.XtraEditors.PopupBaseEdit.UpdateEditValueOnClose(PopupCloseMode closeMode, Boolean acceptValue, Object newValue, Object oldValue) at DevExpress.XtraEditors.PopupBaseEdit.DoClosePopup(PopupCloseMode closeMode) at DevExpress.XtraEditors.PopupBaseEdit.ClosePopup(PopupCloseMode closeMode) at DevExpress.XtraEditors.PopupBaseEdit.ClosePopup() at DevExpress.XtraEditors.Popup.PopupListBox.OnMouseUp(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at DevExpress.Utils.Controls.ControlBase.WndProc(Message& m) at DevExpress.XtraEditors.BaseListBoxControl.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Any idea what is wrong?

Thanks
Henrik Skak Pedersen

Comments (3)
Alessandro (DevExpress Support) 12 years ago

    Thank you for pointing out this issue to us. I was able to replicate this issue locally. Our developers will continue working on this problem and we will get back to you once we have any results.

    H H
    Henrik Skak Pedersen 12 years ago

      Ok, thank you :-)

      Alessandro (DevExpress Support) 12 years ago

        You are welcome! We are always glad to help you in case of any problems.

        Answers approved by DevExpress Support

        created 12 years ago (modified 12 years ago)

        We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

        Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

          Show previous comments (1)
          Alessandro (DevExpress Support) 12 years ago

            I am glad to inform you that we have already fixed this issue in the context of this ticket. Have you download and tested this situation in a public fix from this ticket (http://downloads.devexpress.com/Share/DXP/130509/DXperience-12.1.10.13129.exe)?

              Hello Alessandro, I thought the public fix applies to DX 2012 v1.11? I already have DX 2012 v2.8, and in this ticket it is mentioned that the issue is fixed in 12.2.8 or hotfixed in 12.1.11; Furthermore, the file you linked today says 12.1.10 in its name. I'm confused :) Please check again if the linked file is appropriate for DX 12 v2.8. Thanks!

              DevExpress Support Team 12 years ago

                Hi Tim,
                You are right - the issue presents in version 12.2.8 of our components. I passed it to our developers so they can investigate it and fix it in the mentioned version.
                Please bear with us.

                Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

                Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.