gtk2: fixed av with modal forms. issues #26752,#27577

git-svn-id: trunk@48136 -
This commit is contained in:
zeljko 2015-03-04 16:40:34 +00:00
parent 002d3acb17
commit 7efeb2a3cc

View File

@ -1103,6 +1103,7 @@ var
Mess : TLMessage;
Info: PWidgetInfo;
AStart,AEnd: gint;
AForm: TCustomForm;
{$IFDEF VerboseFocus}
LCLObject: TObject;
CurFocusWidget: PGtkWidget;
@ -1138,8 +1139,23 @@ begin
// do not show selection when widget is unfocused
// issues #18164,#21897,#23182
if GtkWidgetIsA(Widget, gtk_type_entry) then
if GtkWidgetIsA(Widget, gtk_type_entry) and Assigned(Data) then
begin
if (csDestroying in TComponent(Data).ComponentState) or
(csDestroyingHandle in TControl(Data).ControlState) then
begin
// DebugLn('NOTICE: Control is destroying itself, do not add new idle timer for ',dbgsName(TControl(Data)));
exit;
end;
AForm := GetParentForm(TControl(Data));
if Assigned(AForm) and ((csDestroying in AForm.ComponentState) or
(csDestroyingHandle in AForm.ControlState) or
((fsModal in AForm.FormState) and (AForm.ModalResult <> mrNone)) ) then
begin
// DebugLn('NOTICE: Parent form is destroying, do not add new idle timer for ',dbgsName(TControl(Data)));
exit;
end;
g_idle_add(@GtkEntryDelayClearCursorPos, Widget);
//save now CursorPos and SelStart in WidgetInfo
if (Widget <> nil) then