sw/source/uibase/sidebar/CommentsPanel.cxx |    4 ++--
 sw/source/uibase/sidebar/CommentsPanel.hxx |    3 ++-
 sw/uiconfig/swriter/ui/commentsthread.ui   |    2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit ac38f7d53755459a6fdc4cc9064b93e07501fe56
Author:     Mohit Marathe <mohitmara...@proton.me>
AuthorDate: Sat Sep 21 18:37:55 2024 +0530
Commit:     Sarper Akdemir <sarper.akde...@allotropia.de>
CommitDate: Sun Sep 22 16:15:57 2024 +0200

    sw: fix comment sidebar crash in generic backend
    
    Change-Id: Ie16d7bc61ebeeb7da2b31926d1ef0046d993e1f2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173759
    Tested-by: Jenkins
    Reviewed-by: Sarper Akdemir <sarper.akde...@allotropia.de>

diff --git a/sw/source/uibase/sidebar/CommentsPanel.cxx 
b/sw/source/uibase/sidebar/CommentsPanel.cxx
index cf4f624cb048..e85ad128998a 100644
--- a/sw/source/uibase/sidebar/CommentsPanel.cxx
+++ b/sw/source/uibase/sidebar/CommentsPanel.cxx
@@ -172,8 +172,8 @@ IMPL_LINK_NOARG(Comment, ReplyClicked, weld::Button&, void) 
{ mrCommentsPanel.Re
 Thread::Thread(weld::Container* pParent)
     : mxBuilder(Application::CreateBuilder(pParent, 
"modules/swriter/ui/commentsthread.ui"))
     , mxContainer(mxBuilder->weld_container("Thread"))
+    , mxExpander(mxBuilder->weld_expander("expander"))
     , mxCommentBox(mxBuilder->weld_box("comments_box"))
-    , mxText(mxBuilder->weld_label("commentedtext"))
 {
     // mxContainer->set_size_request(-1, 
mxContainer->get_preferred_size().Height());
 }
@@ -597,7 +597,7 @@ void CommentsPanel::setReferenceText(sal_uInt32 nRootId)
     sw::mark::MarkManager& rMarkManager = mpDoc->GetMarkManager();
     sw::mark::AnnotationMark* pMark = 
rMarkManager.getAnnotationMarkFor(pAnchor);
     OUString sText = getReferenceText(pTextNode, pMark);
-    pThread->mxText->set_label(sText);
+    pThread->getExpander()->set_label(sText);
 }
 
 void CommentsPanel::EditComment(Comment* pComment)
diff --git a/sw/source/uibase/sidebar/CommentsPanel.hxx 
b/sw/source/uibase/sidebar/CommentsPanel.hxx
index 7d2de3f1529e..a258472c9235 100644
--- a/sw/source/uibase/sidebar/CommentsPanel.hxx
+++ b/sw/source/uibase/sidebar/CommentsPanel.hxx
@@ -101,13 +101,14 @@ class Thread final
 private:
     std::unique_ptr<weld::Builder> mxBuilder;
     std::unique_ptr<weld::Container> mxContainer;
+    std::unique_ptr<weld::Expander> mxExpander;
     std::unique_ptr<weld::Box> mxCommentBox;
-    std::unique_ptr<weld::Label> mxText;
 
 public:
     Thread(weld::Container* pParent);
     ~Thread();
     weld::Widget* get_widget() const { return mxContainer.get(); }
+    weld::Expander* getExpander() const { return mxExpander.get(); }
     weld::Box* getCommentBoxWidget() const { return mxCommentBox.get(); }
 
     sal_uInt16 mnComments = 0;
diff --git a/sw/uiconfig/swriter/ui/commentsthread.ui 
b/sw/uiconfig/swriter/ui/commentsthread.ui
index ca5600fa767e..6a8980580484 100644
--- a/sw/uiconfig/swriter/ui/commentsthread.ui
+++ b/sw/uiconfig/swriter/ui/commentsthread.ui
@@ -8,7 +8,7 @@
     <property name="can-focus">False</property>
     <property name="margin-bottom">10</property>
     <child>
-      <object class="GtkExpander">
+      <object class="GtkExpander" id="expander">
         <property name="visible">True</property>
         <property name="can-focus">True</property>
         <property name="hexpand">True</property>

Reply via email to