mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 19:09:19 +02:00
gtk2 intf: TComboBox: fixed gtk crit when ITemCount=0
git-svn-id: trunk@11015 -
This commit is contained in:
parent
0e395c80ce
commit
ef4cb4d516
@ -2272,7 +2272,12 @@ function TGtkWidgetSet.ComboBoxDropDown(Handle: HWND; DropDown: boolean): boolea
|
||||
avail_height := gdk_screen_height () - y;
|
||||
|
||||
New(list_requisition);
|
||||
gtk_widget_size_request (combo^.list, list_requisition);
|
||||
if combo^.list<>nil then begin
|
||||
gtk_widget_size_request (combo^.list, list_requisition);
|
||||
end else begin
|
||||
list_requisition^.height:=1;
|
||||
list_requisition^.width:=1;
|
||||
end;
|
||||
|
||||
min_height := MIN (list_requisition^.height,popup^.vscrollbar^.requisition.height);
|
||||
if GTK_LIST (combo^.list)^.children = nil then
|
||||
@ -8429,9 +8434,13 @@ begin
|
||||
FirstChild:=PGTkList(ListWidget)^.children;
|
||||
if FirstChild<>nil then begin
|
||||
FirstChildWidget:=PGtkWidget(FirstChild^.Data);
|
||||
gtk_widget_size_request(FirstChildWidget,@item_requisition);
|
||||
CurItemHeight:=Max(FirstChildWidget^.Allocation.Height,
|
||||
item_requisition.Height);
|
||||
if FirstChildWidget<>nil then begin
|
||||
gtk_widget_size_request(FirstChildWidget,@item_requisition);
|
||||
CurItemHeight:=Max(FirstChildWidget^.Allocation.Height,
|
||||
item_requisition.Height);
|
||||
end else begin
|
||||
CurItemHeight:=1;
|
||||
end;
|
||||
if MinItemsHeight<CurItemHeight*MinItemCount then
|
||||
MinItemsHeight:=CurItemHeight*MinItemCount;
|
||||
end;
|
||||
|
@ -613,8 +613,10 @@ begin
|
||||
while GListItem<>nil do begin
|
||||
ListItemWidget:=PGtkWidget(GListItem^.data);
|
||||
if i>=NewTopIndex then break;
|
||||
gtk_widget_size_request(ListItemWidget,@requisition);
|
||||
inc(AdjValue,requisition.height);
|
||||
if ListItemWidget<>nil then begin
|
||||
gtk_widget_size_request(ListItemWidget,@requisition);
|
||||
inc(AdjValue,requisition.height);
|
||||
end;
|
||||
//DebugLn(['TGtkWSCustomListBox.SetTopIndex ',i,' AdjValue=',AdjValue,' Flags=',WidgetFlagsToString(ListItemWidget)]);
|
||||
inc(i);
|
||||
GListItem:=GListItem^.next;
|
||||
|
@ -71,10 +71,11 @@ begin
|
||||
p := GetWidgetInfo(Pointer(Handle), False)^.CoreWidget;
|
||||
|
||||
Menu := PGtkWidget(g_object_get_data(G_OBJECT(p), 'Menu'));
|
||||
|
||||
Requisition.width := MinItemsWidth;
|
||||
Requisition.height := MinItemsHeight * MinItemCount;
|
||||
gtk_widget_size_request(Menu, @Requisition);
|
||||
if Menu<>nil then begin
|
||||
Requisition.width := MinItemsWidth;
|
||||
Requisition.height := MinItemsHeight * MinItemCount;
|
||||
gtk_widget_size_request(Menu, @Requisition);
|
||||
end;
|
||||
end;
|
||||
|
||||
//##apiwiz##eps## // Do not remove, no wizard declaration after this line
|
||||
|
Loading…
Reference in New Issue
Block a user