mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 20:59:17 +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;
|
avail_height := gdk_screen_height () - y;
|
||||||
|
|
||||||
New(list_requisition);
|
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);
|
min_height := MIN (list_requisition^.height,popup^.vscrollbar^.requisition.height);
|
||||||
if GTK_LIST (combo^.list)^.children = nil then
|
if GTK_LIST (combo^.list)^.children = nil then
|
||||||
@ -8429,9 +8434,13 @@ begin
|
|||||||
FirstChild:=PGTkList(ListWidget)^.children;
|
FirstChild:=PGTkList(ListWidget)^.children;
|
||||||
if FirstChild<>nil then begin
|
if FirstChild<>nil then begin
|
||||||
FirstChildWidget:=PGtkWidget(FirstChild^.Data);
|
FirstChildWidget:=PGtkWidget(FirstChild^.Data);
|
||||||
gtk_widget_size_request(FirstChildWidget,@item_requisition);
|
if FirstChildWidget<>nil then begin
|
||||||
CurItemHeight:=Max(FirstChildWidget^.Allocation.Height,
|
gtk_widget_size_request(FirstChildWidget,@item_requisition);
|
||||||
item_requisition.Height);
|
CurItemHeight:=Max(FirstChildWidget^.Allocation.Height,
|
||||||
|
item_requisition.Height);
|
||||||
|
end else begin
|
||||||
|
CurItemHeight:=1;
|
||||||
|
end;
|
||||||
if MinItemsHeight<CurItemHeight*MinItemCount then
|
if MinItemsHeight<CurItemHeight*MinItemCount then
|
||||||
MinItemsHeight:=CurItemHeight*MinItemCount;
|
MinItemsHeight:=CurItemHeight*MinItemCount;
|
||||||
end;
|
end;
|
||||||
|
@ -613,8 +613,10 @@ begin
|
|||||||
while GListItem<>nil do begin
|
while GListItem<>nil do begin
|
||||||
ListItemWidget:=PGtkWidget(GListItem^.data);
|
ListItemWidget:=PGtkWidget(GListItem^.data);
|
||||||
if i>=NewTopIndex then break;
|
if i>=NewTopIndex then break;
|
||||||
gtk_widget_size_request(ListItemWidget,@requisition);
|
if ListItemWidget<>nil then begin
|
||||||
inc(AdjValue,requisition.height);
|
gtk_widget_size_request(ListItemWidget,@requisition);
|
||||||
|
inc(AdjValue,requisition.height);
|
||||||
|
end;
|
||||||
//DebugLn(['TGtkWSCustomListBox.SetTopIndex ',i,' AdjValue=',AdjValue,' Flags=',WidgetFlagsToString(ListItemWidget)]);
|
//DebugLn(['TGtkWSCustomListBox.SetTopIndex ',i,' AdjValue=',AdjValue,' Flags=',WidgetFlagsToString(ListItemWidget)]);
|
||||||
inc(i);
|
inc(i);
|
||||||
GListItem:=GListItem^.next;
|
GListItem:=GListItem^.next;
|
||||||
|
@ -71,10 +71,11 @@ begin
|
|||||||
p := GetWidgetInfo(Pointer(Handle), False)^.CoreWidget;
|
p := GetWidgetInfo(Pointer(Handle), False)^.CoreWidget;
|
||||||
|
|
||||||
Menu := PGtkWidget(g_object_get_data(G_OBJECT(p), 'Menu'));
|
Menu := PGtkWidget(g_object_get_data(G_OBJECT(p), 'Menu'));
|
||||||
|
if Menu<>nil then begin
|
||||||
Requisition.width := MinItemsWidth;
|
Requisition.width := MinItemsWidth;
|
||||||
Requisition.height := MinItemsHeight * MinItemCount;
|
Requisition.height := MinItemsHeight * MinItemCount;
|
||||||
gtk_widget_size_request(Menu, @Requisition);
|
gtk_widget_size_request(Menu, @Requisition);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//##apiwiz##eps## // Do not remove, no wizard declaration after this line
|
//##apiwiz##eps## // Do not remove, no wizard declaration after this line
|
||||||
|
Loading…
Reference in New Issue
Block a user