ardovm commented on code in PR #485:
URL: https://github.com/apache/openoffice/pull/485#discussion_r3454959161


##########
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

Review Comment:
   I understand that "the loop above" should be at lines 2811-2828. This 
comment and the following code should be closer to that, shouldn't they?
   
   In addition, I do not see the `delete` and `new` as deterministic as the 
comment states. Reading the code, I understand that `pTabData[]` entries 
_could_ be recreated or not.



##########
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];

Review Comment:
   Why not rather call `ScViewData::UpdateThis()`?
   
   This code creates `pTabData[nTabNo]` if it does not exist.
   `ScViewData::UpdateThis()` searches for the last existing element of 
`pTabData[]` without changing its contents.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to