Gtk2: fixed crash with GtkIconView when multiselect is enabled and dbl clicked. issue #22991

git-svn-id: trunk@38868 -
This commit is contained in:
zeljko 2012-09-27 16:10:08 +00:00
parent 35e042eb08
commit 0b23e9c0ae

View File

@ -1612,6 +1612,23 @@ begin
end; end;
end; end;
procedure FixListViewRubberBand(AWidget: PGtkWidget);
var
Info: PWidgetInfo;
IconView: PGtkIconView;
Priv: _PGtkIconViewPrivate;
begin
Info := GetWidgetInfo(AWidget);
IconView := PGtkIconView(Info^.CoreWidget);
Priv := IconView^.priv;
if Priv^.doing_rubberband then
begin
Priv^.doing_rubberband := False;
gtk_widget_queue_draw(AWidget);
end;
end;
{------------------------------------------------------------------------------- {-------------------------------------------------------------------------------
function ControlGetsMouseDownBefore(AControl: TControl): boolean; function ControlGetsMouseDownBefore(AControl: TControl): boolean;
@ -1652,6 +1669,17 @@ begin
end; end;
end; end;
end; end;
end else
if not (csDesigning in AControl.ComponentState) and
(Event^.button = 1) and
(gdk_event_get_type(Event) = GDK_BUTTON_PRESS) and
(AControl is TWinControl) and
(TWinControl(AControl).FCompStyle = csListView) and
(TListView(AControl).ViewStyle in [vsIcon, vsSmallIcon]) and
TListView(AControl).MultiSelect then
begin
// issue #22991
FixListViewRubberBand(PGtkWidget(TWinControl(AControl).Handle));
end; end;
end; end;
@ -2215,24 +2243,6 @@ function gtkMouseBtnRelease(widget: PGtkWidget; event : pgdkEventButton;
var var
DesignOnlySignal: boolean; DesignOnlySignal: boolean;
AForm: TCustomForm; AForm: TCustomForm;
procedure FixListViewRubberBand;
var
Info: PWidgetInfo;
IconView: PGtkIconView;
Priv: _PGtkIconViewPrivate;
begin
Info := GetWidgetInfo(Widget);
IconView := PGtkIconView(Info^.CoreWidget);
Priv := IconView^.priv;
if Priv^.doing_rubberband then
begin
Priv^.doing_rubberband := False;
gtk_widget_queue_draw(Widget);
end;
end;
begin begin
Result := CallBackDefaultReturn; Result := CallBackDefaultReturn;
{$IFDEF VerboseMouseBugfix} {$IFDEF VerboseMouseBugfix}
@ -2259,7 +2269,7 @@ begin
TListView(Data).MultiSelect then TListView(Data).MultiSelect then
begin begin
// fixed crash.See issue #22778 // fixed crash.See issue #22778
FixListViewRubberBand; FixListViewRubberBand(Widget);
end; end;
ReleaseMouseCapture; ReleaseMouseCapture;