mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 15:59:13 +02:00
SourceEdit: Do not access outdated tab-history entries (dangling pointers). Issue #0021939
git-svn-id: trunk@37195 -
This commit is contained in:
parent
19e4380062
commit
b66752bd74
@ -5554,9 +5554,8 @@ begin
|
||||
// add recent tabs. skip 0 since that is the active tab
|
||||
for i := 1 to Min(10, FHistoryList.Count-1) do
|
||||
begin
|
||||
//HistoryGetTopPageIndex;
|
||||
EditorCur := FindSourceEditorWithPageIndex(TTabSheet(FHistoryList[i]).PageIndex);
|
||||
if not EditorCur.FEditor.HandleAllocated then continue; // show only if it was visited
|
||||
EditorCur := FindSourceEditorWithPageIndex(FNotebook.IndexOf(TCustomPage(FHistoryList[i])));
|
||||
if (EditorCur = nil) or (not EditorCur.FEditor.HandleAllocated) then continue; // show only if it was visited
|
||||
AddEditorToMenuSection(EditorCur, RecMenu, i);
|
||||
RecMenu.Visible := True;
|
||||
end;
|
||||
@ -6319,12 +6318,12 @@ end;
|
||||
|
||||
procedure TSourceNotebook.NoteBookDeletePage(APageIndex: Integer);
|
||||
begin
|
||||
HistoryRemove(FNotebook.Pages[APageIndex]);
|
||||
if PageCount > 1 then begin
|
||||
// make sure to select another page in the NoteBook, otherwise the
|
||||
// widgetset will choose one and will send a message
|
||||
// if this is the current page, switch to right APageIndex (if possible)
|
||||
//todo: determine whether we can use SetPageIndex instead
|
||||
HistoryRemove(FNotebook.Pages[APageIndex]);
|
||||
if PageIndex = APageIndex then begin
|
||||
if EditorOpts.UseTabHistory then
|
||||
FPageIndex := HistoryGetTopPageIndex
|
||||
|
Loading…
Reference in New Issue
Block a user