include/sfx2/sfxsids.hrc                            |    1 +
 include/svx/sidebar/InspectorTextPanel.hxx          |    4 +---
 svx/source/sidebar/inspector/InspectorTextPanel.cxx |   10 ++++------
 sw/inc/cmdid.h                                      |    2 --
 sw/sdi/_viewsh.sdi                                  |    2 +-
 sw/sdi/swriter.sdi                                  |    2 +-
 sw/source/uibase/uiview/view0.cxx                   |    6 +++---
 7 files changed, 11 insertions(+), 16 deletions(-)

New commits:
commit 6fc54eea2f904a6704495f6b53fd5eff0dff1496
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Sep 8 19:55:45 2025 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Sep 9 17:07:54 2025 +0200

    crashreport: avoid crash in InspectorTextPanel
    
    define FN_HIGHLIGHT_CHAR_DF in sfx2 like the
    other spotlight slots and rename it accordingly
    
    Seen in 
https://crashreport.libreoffice.org/stats/crash_details/a6200006-147e-4829-9293-93de0487133b
    
    Since
    commit 0d0e5c72e6344de48227b74846a6ff638b803c64
    Author: Karthik <m...@karthikreddy.org>
    Date:   Mon Mar 10 13:34:39 2025 +0530
    
        tdf#160194 Add 3 checkboxes in Style InspectorPanel
    
    
    Change-Id: I108fcbf39c8f6879258c9804f7f5a15313d259ec
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190684
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index f97a62d00d65..b2364a1001ec 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -390,6 +390,7 @@ class SvxZoomItem;
 
 #define SID_SPOTLIGHT_PARASTYLES            
TypedWhichId<SfxBoolItem>(SID_SFX_START + 1605)
 #define SID_SPOTLIGHT_CHARSTYLES            
TypedWhichId<SfxBoolItem>(SID_SFX_START + 1606)
+#define SID_SPOTLIGHT_CHAR_DF               
TypedWhichId<SfxBoolItem>(SID_SFX_START + 1607)
 
 #define SID_TEMPLATE_NAME                   
TypedWhichId<SfxStringItem>(SID_SFX_START + 660)
 #define SID_TEMPLATE_REGIONNAME             
TypedWhichId<SfxStringItem>(SID_SFX_START + 662)
diff --git a/include/svx/sidebar/InspectorTextPanel.hxx 
b/include/svx/sidebar/InspectorTextPanel.hxx
index 331ea29f0fe5..ae34f720d4a4 100644
--- a/include/svx/sidebar/InspectorTextPanel.hxx
+++ b/include/svx/sidebar/InspectorTextPanel.hxx
@@ -63,13 +63,11 @@ private:
 
     std::unique_ptr<weld::Toolbar> mpToolbar;
 
-    sal_uInt16 nSlotDFStyles;
-
     sfx2::sidebar::ControllerItem mParaController;
     sfx2::sidebar::ControllerItem mCharController;
     sfx2::sidebar::ControllerItem mDFController;
 
-    DECL_LINK(ToolbarHdl, const OUString&, void);
+    DECL_STATIC_LINK(InspectorTextPanel, ToolbarHdl, const OUString&, void);
 };
 
 } // end of namespace svx::sidebar
diff --git a/svx/source/sidebar/inspector/InspectorTextPanel.cxx 
b/svx/source/sidebar/inspector/InspectorTextPanel.cxx
index 930ed0f792e6..d377acd047b9 100644
--- a/svx/source/sidebar/inspector/InspectorTextPanel.cxx
+++ b/svx/source/sidebar/inspector/InspectorTextPanel.cxx
@@ -44,10 +44,9 @@ namespace svx::sidebar
 InspectorTextPanel::InspectorTextPanel(weld::Widget* pParent, SfxBindings* 
pBindings)
     : PanelLayout(pParent, u"InspectorTextPanel"_ustr, 
u"svx/ui/inspectortextpanel.ui"_ustr)
     , mpListBoxStyles(m_xBuilder->weld_tree_view(u"listbox_fonts"_ustr))
-    , 
nSlotDFStyles(pBindings->GetDispatcher()->GetSlot(".uno:HighlightCharDF")->GetSlotId())
     , mParaController(SID_SPOTLIGHT_PARASTYLES, *pBindings, *this)
     , mCharController(SID_SPOTLIGHT_CHARSTYLES, *pBindings, *this)
-    , mDFController(nSlotDFStyles, *pBindings, *this)
+    , mDFController(SID_SPOTLIGHT_CHAR_DF, *pBindings, *this)
 {
     mpListBoxStyles->set_size_request(MinimumPanelWidth, -1);
     float fWidth = mpListBoxStyles->get_approximate_digit_width();
@@ -64,7 +63,7 @@ InspectorTextPanel::InspectorTextPanel(weld::Widget* pParent, 
SfxBindings* pBind
     // Setup listening and set initial state
     pBindings->Update(SID_SPOTLIGHT_PARASTYLES);
     pBindings->Update(SID_SPOTLIGHT_CHARSTYLES);
-    pBindings->Update(nSlotDFStyles);
+    pBindings->Update(SID_SPOTLIGHT_CHAR_DF);
 }
 
 static bool GetPropertyValues(std::u16string_view rPropName, const uno::Any& 
rAny,
@@ -194,7 +193,7 @@ void InspectorTextPanel::NotifyItemUpdate(const sal_uInt16 
nSId, const SfxItemSt
     }
 }
 
-IMPL_LINK(InspectorTextPanel, ToolbarHdl, const OUString&, rEntry, void)
+IMPL_STATIC_LINK(InspectorTextPanel, ToolbarHdl, const OUString&, rEntry, void)
 {
     SfxDispatcher* pDispatcher = SfxViewFrame::Current()->GetDispatcher();
     if (rEntry == "paragraphstyles")
@@ -207,8 +206,7 @@ IMPL_LINK(InspectorTextPanel, ToolbarHdl, const OUString&, 
rEntry, void)
     }
     else
     {
-        SfxBoolItem aItem(nSlotDFStyles, mpToolbar->get_item_active(rEntry));
-        pDispatcher->ExecuteList(nSlotDFStyles, SfxCallMode::SYNCHRON, { 
&aItem });
+        pDispatcher->Execute(SID_SPOTLIGHT_CHAR_DF, SfxCallMode::SYNCHRON);
     }
 }
 
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 6a21d4e2d65a..ce9293a0b4ef 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -174,8 +174,6 @@ class SwUINumRuleItem;
 #define FN_VIEW_FIELDNAME       (FN_VIEW + 26)  /* View field names */
 #define FN_VIEW_TABLEGRID       (FN_VIEW + 27)  /* View tablegrid */
 
-#define FN_HIGHLIGHT_CHAR_DF    (FN_VIEW + 28)
-
 #define FN_SET_PAGE             (FN_VIEW + 29)  /* Set page template to 
paragraph */
 
 #define FN_PRINT_LAYOUT         (FN_VIEW + 37)  /* print layout */
diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi
index c4f80693a619..c0c018ae762f 100644
--- a/sw/sdi/_viewsh.sdi
+++ b/sw/sdi/_viewsh.sdi
@@ -969,7 +969,7 @@ interface BaseTextEditView
         StateMethod = StateViewOptions ;
     ]
 
-    FN_HIGHLIGHT_CHAR_DF
+    SID_SPOTLIGHT_CHAR_DF
     [
         ExecMethod = ExecViewOptions ;
         StateMethod = StateViewOptions ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 43041dad49dd..7209b09ed571 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -4209,7 +4209,7 @@ SfxBoolItem Marks FN_VIEW_MARKS
     GroupId = SfxGroupId::View;
 ]
 
-SfxBoolItem HighlightCharDF FN_HIGHLIGHT_CHAR_DF
+SfxBoolItem HighlightCharDF SID_SPOTLIGHT_CHAR_DF
 
 [
     AutoUpdate = TRUE,
diff --git a/sw/source/uibase/uiview/view0.cxx 
b/sw/source/uibase/uiview/view0.cxx
index c263e1bad11d..0147e3679cba 100644
--- a/sw/source/uibase/uiview/view0.cxx
+++ b/sw/source/uibase/uiview/view0.cxx
@@ -222,7 +222,7 @@ void SwView::StateViewOptions(SfxItemSet &rSet)
     while(nWhich)
     {
         bool bReadonly = GetDocShell()->IsReadOnly();
-        if (bReadonly && nWhich != FN_VIEW_GRAPHIC && nWhich != 
FN_HIGHLIGHT_CHAR_DF
+        if (bReadonly && nWhich != FN_VIEW_GRAPHIC && nWhich != 
SID_SPOTLIGHT_CHAR_DF
             && nWhich != SID_AUTOSPELL_CHECK)
         {
             rSet.DisableItem(nWhich);
@@ -359,7 +359,7 @@ void SwView::StateViewOptions(SfxItemSet &rSet)
             case FN_SHOW_CHANGES_IN_MARGIN:
               aBool.SetValue( pOpt->IsShowChangesInMargin() );
             break;
-            case FN_HIGHLIGHT_CHAR_DF:
+            case SID_SPOTLIGHT_CHAR_DF:
               aBool.SetValue(m_bIsHighlightCharDF);
             break;
             case SID_SPOTLIGHT_PARASTYLES:
@@ -594,7 +594,7 @@ void SwView::ExecViewOptions(SfxRequest &rReq)
         lcl_SetViewMarks( *pOpt, bFlag );
         break;
 
-    case FN_HIGHLIGHT_CHAR_DF:
+    case SID_SPOTLIGHT_CHAR_DF:
         if (STATE_TOGGLE == eState)
             bFlag = !m_bIsHighlightCharDF;
         m_bIsHighlightCharDF = bFlag;

Reply via email to