You've already forked lazarus-ccr
tvplanit: Fix crash in WeekView caused by destruction of inplace editor.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4705 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -483,6 +483,7 @@ end;
|
|||||||
|
|
||||||
destructor TVpWeekView.Destroy;
|
destructor TVpWeekView.Destroy;
|
||||||
begin
|
begin
|
||||||
|
FreeAndNil(wvInplaceEditor);
|
||||||
FDayHeadAttributes.Free;
|
FDayHeadAttributes.Free;
|
||||||
FAllDayEventAttr.Free;
|
FAllDayEventAttr.Free;
|
||||||
FHeadAttr.Free;
|
FHeadAttr.Free;
|
||||||
@ -1822,13 +1823,16 @@ begin
|
|||||||
|
|
||||||
if AllowIt then begin
|
if AllowIt then begin
|
||||||
{ create and spawn the in-place editor }
|
{ create and spawn the in-place editor }
|
||||||
|
if wvInplaceEditor = nil then begin
|
||||||
wvInPlaceEditor := TVpWvInPlaceEdit.Create(Self);
|
wvInPlaceEditor := TVpWvInPlaceEdit.Create(Self);
|
||||||
wvInPlaceEditor.Parent := self;
|
wvInPlaceEditor.Parent := self;
|
||||||
wvInPlaceEditor.OnExit := EndEdit;
|
wvInPlaceEditor.OnExit := EndEdit;
|
||||||
|
end;
|
||||||
wvInPlaceEditor.SetBounds(wvActiveEventRec.Left + TextMargin,
|
wvInPlaceEditor.SetBounds(wvActiveEventRec.Left + TextMargin,
|
||||||
wvActiveEventRec.Top,
|
wvActiveEventRec.Top,
|
||||||
wvActiveEventRec.Right - (TextMargin*2),
|
wvActiveEventRec.Right - (TextMargin*2),
|
||||||
wvActiveEventRec.Bottom- (TextMargin*2));
|
wvActiveEventRec.Bottom- (TextMargin*2));
|
||||||
|
wvInplaceEditor.Show;
|
||||||
wvInPlaceEditor.Text := ActiveEvent.Description;
|
wvInPlaceEditor.Text := ActiveEvent.Description;
|
||||||
Invalidate;
|
Invalidate;
|
||||||
wvInPlaceEditor.SetFocus;
|
wvInPlaceEditor.SetFocus;
|
||||||
@ -1932,7 +1936,7 @@ end;
|
|||||||
|
|
||||||
procedure TVpWeekView.EndEdit(Sender: TObject);
|
procedure TVpWeekView.EndEdit(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if wvInPlaceEditor <> nil then begin
|
if (wvInPlaceEditor <> nil) and (ActiveEvent <> nil) then begin
|
||||||
if wvInPlaceEditor.Text <> ActiveEvent.Description then begin
|
if wvInPlaceEditor.Text <> ActiveEvent.Description then begin
|
||||||
ActiveEvent.Description := wvInPlaceEditor.Text;
|
ActiveEvent.Description := wvInPlaceEditor.Text;
|
||||||
ActiveEvent.Changed := true;
|
ActiveEvent.Changed := true;
|
||||||
@ -1940,7 +1944,7 @@ begin
|
|||||||
FAfterEdit(self, ActiveEvent);
|
FAfterEdit(self, ActiveEvent);
|
||||||
DataStore.PostEvents;
|
DataStore.PostEvents;
|
||||||
end;
|
end;
|
||||||
FreeAndNil(wvInPlaceEditor);
|
wvInplaceEditor.Hide;
|
||||||
Invalidate;
|
Invalidate;
|
||||||
// SetFocus;
|
// SetFocus;
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user