mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 17:11:59 +02:00
Gtk2: fixed crashes with gtk2 notebook when some of tabs is hidden (tabvisible=false).same as issue #20793.
git-svn-id: trunk@33959 -
This commit is contained in:
parent
32c69a923e
commit
ded3c818b7
@ -470,6 +470,8 @@ class procedure TGtk2WSCustomTabControl.SetPageIndex(
|
||||
const ATabControl: TCustomTabControl; const AIndex: integer);
|
||||
var
|
||||
GtkNotebook: PGtkNotebook;
|
||||
ANewIndex: Integer;
|
||||
Page: PGtkWidget;
|
||||
begin
|
||||
if not WSCheckHandleAllocated(ATabControl, 'SetPageIndex') then
|
||||
Exit;
|
||||
@ -477,8 +479,15 @@ begin
|
||||
GtkNotebook := PGtkNoteBook(ATabControl.Handle);
|
||||
if gtk_notebook_get_current_page(GtkNotebook) <> AIndex then
|
||||
begin
|
||||
gtk_object_set_data(PGtkObject(GtkNotebook), LCL_NotebookManualPageSwitchKey, ATabControl);
|
||||
gtk_notebook_set_page(GtkNotebook, AIndex);
|
||||
// gtk2 cannot set page if some tab in between tabvisible=false, so
|
||||
// we must compare page handles.
|
||||
if ATabControl.Page[AIndex].HandleAllocated then
|
||||
begin
|
||||
Page := PGtkWidget(ATabControl.Page[AIndex].Handle);
|
||||
ANewIndex := gtk_notebook_page_num(GtkNoteBook, Page);
|
||||
gtk_object_set_data(PGtkObject(GtkNotebook), LCL_NotebookManualPageSwitchKey, ATabControl);
|
||||
gtk_notebook_set_page(GtkNotebook, ANewIndex);
|
||||
end;
|
||||
end;
|
||||
UpdateNoteBookClientWidget(ATabControl);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user