This is an automated email from the ASF dual-hosted git repository.

jimjag pushed a commit to branch AOO50X
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 8e4a34ea5c8a35bbd8012f83e541ad1da49742bb
Author: Peter <[email protected]>
AuthorDate: Tue Oct 20 14:52:44 2026 +0200

    Calc: restore pThisTab after ReadUserDataSequence recreates tab data (#485)
    
    (cherry picked from commit cb52b75cae51232395ed2a695fbd19c3ccf1e975)
---
 main/sc/source/ui/view/viewdata.cxx | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/main/sc/source/ui/view/viewdata.cxx 
b/main/sc/source/ui/view/viewdata.cxx
index 26b4b3ec50..cabcd6eaa9 100644
--- a/main/sc/source/ui/view/viewdata.cxx
+++ b/main/sc/source/ui/view/viewdata.cxx
@@ -2952,6 +2952,15 @@ void ScViewData::ReadUserDataSequence(const 
uno::Sequence <beans::PropertyValue>
             pTabData[nZoomTab]->aPageZoomY = aDefPageZoomY;
         }
 
+       // The loop above delete'd and re-new'd pTabData[] entries (including 
the
+       // active one) but left pThisTab pointing at a freed ScViewDataTable.  
Restore
+       // the pThisTab == pTabData[nTabNo] invariant before anyone 
dereferences it
+       // (e.g. ScTabView::SetTabNo -> GetActivePart()).  Mirrors SetTabNo 
(line
+       // ~1502).  Without it, a debug build AVs on document open (reads 
0xDDDDDDDD);
+       // release masks it only via allocator MRU reuse.
+       CreateTabData( nTabNo );
+       pThisTab = pTabData[nTabNo];
+
        if (nCount)
                SetPagebreakMode( bPageMode );
 

Reply via email to