mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 02:39:37 +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
|
// add recent tabs. skip 0 since that is the active tab
|
||||||
for i := 1 to Min(10, FHistoryList.Count-1) do
|
for i := 1 to Min(10, FHistoryList.Count-1) do
|
||||||
begin
|
begin
|
||||||
//HistoryGetTopPageIndex;
|
EditorCur := FindSourceEditorWithPageIndex(FNotebook.IndexOf(TCustomPage(FHistoryList[i])));
|
||||||
EditorCur := FindSourceEditorWithPageIndex(TTabSheet(FHistoryList[i]).PageIndex);
|
if (EditorCur = nil) or (not EditorCur.FEditor.HandleAllocated) then continue; // show only if it was visited
|
||||||
if not EditorCur.FEditor.HandleAllocated then continue; // show only if it was visited
|
|
||||||
AddEditorToMenuSection(EditorCur, RecMenu, i);
|
AddEditorToMenuSection(EditorCur, RecMenu, i);
|
||||||
RecMenu.Visible := True;
|
RecMenu.Visible := True;
|
||||||
end;
|
end;
|
||||||
@ -6319,12 +6318,12 @@ end;
|
|||||||
|
|
||||||
procedure TSourceNotebook.NoteBookDeletePage(APageIndex: Integer);
|
procedure TSourceNotebook.NoteBookDeletePage(APageIndex: Integer);
|
||||||
begin
|
begin
|
||||||
|
HistoryRemove(FNotebook.Pages[APageIndex]);
|
||||||
if PageCount > 1 then begin
|
if PageCount > 1 then begin
|
||||||
// make sure to select another page in the NoteBook, otherwise the
|
// make sure to select another page in the NoteBook, otherwise the
|
||||||
// widgetset will choose one and will send a message
|
// widgetset will choose one and will send a message
|
||||||
// if this is the current page, switch to right APageIndex (if possible)
|
// if this is the current page, switch to right APageIndex (if possible)
|
||||||
//todo: determine whether we can use SetPageIndex instead
|
//todo: determine whether we can use SetPageIndex instead
|
||||||
HistoryRemove(FNotebook.Pages[APageIndex]);
|
|
||||||
if PageIndex = APageIndex then begin
|
if PageIndex = APageIndex then begin
|
||||||
if EditorOpts.UseTabHistory then
|
if EditorOpts.UseTabHistory then
|
||||||
FPageIndex := HistoryGetTopPageIndex
|
FPageIndex := HistoryGetTopPageIndex
|
||||||
|
Loading…
Reference in New Issue
Block a user