- This topic has 6 replies, 3 voices, and was last updated 4 years, 9 months ago by
kimbomadsen.
-
AuthorPosts
-
-
March 12, 2021 at 10:59 #55576
TomYU
Participanthi,kim
FBindings:=TkbmMWBindings.Create;
FBindings.Clear;
When the Clear method is called for the second time, an address error occurs.
kbmMW 5.14 has this problem, 5.13.10 is normal.
procedure TkbmMWBindings.Clear;
begin
while TkbmMWInterlocked.Increment(FSyncUpdateRunning)>1 do
begin
TkbmMWInterlocked.Decrement(FSyncUpdateRunning);
CheckSynchronize;
end;DisableSyncUpdate;
try
FScheduler.UnScheduleGroup(‘RUN’);
FSyncList.Clear;//The address generated by this line is wrongdelphi 10.4.2+kbmMW 5.14
best regards
Tom YU
…
-
March 16, 2021 at 01:45 #55578
TomYU
ParticipantBecause of this issue, I cannot upgrade to kbmMW 5.14!
-
March 25, 2021 at 01:12 #55592
kimbomadsen
KeymasterI’ve made a simple test like this:
procedure TForm1.FormCreate(Sender: TObject); var FBindings:TkbmMWBindings; begin FBindings:=TkbmMWBindings.Create; FBindings.Clear; FBindings.Clear; FBindings.Free; end;which works perfectly well without any exceptions. Be aware that you _must_ free your binding instance before application closes.
-
March 25, 2021 at 02:36 #55594
TomYU
Participantprocedure TListDialogFrame.PrepareView; begin if DisplayDataSet <> nil then begin ListViewSearchBox(ListView1).Text:=''; FBindings.Clear;//******************* if KeyFieldName <> '' then FBindings.Bind(DisplayDataSet, KeyFieldName, ListView1, ''); FBindings.Bind(DisplayDataSet,DisplayFieldName,ListView1,'#Caption'); FBindings.Bind(DisplaydataSet,'@',ListView1,'@',[mwboTwoWay]); //双向绑定.位置同步. FBindings.Update; FBindings.UpdateEvent.Activate(True); end else begin FBindings.Clear;//***************** FillListFromDisplayStringList; end; end; -
March 25, 2021 at 02:45 #55597
TomYU
ParticipantThis problem is real in my actual project, for this reason I cannot upgrade to kbmMW 5.14.
-
March 25, 2021 at 13:57 #55600
tomyu666
ParticipantI see, the problem is caused by this line of code:
FBindings.UpdateEvent.Activate(False);
procedure TForm1.FormCreate(Sender: TObject); var FBindings:TkbmMWBindings; begin FBindings:=TkbmMWBindings.Create; FBindings.Clear; FBindings.UpdateEvent.Activate(False);FBindings.Clear;// An error FBindings.Free; end; -
March 25, 2021 at 22:27 #55603
kimbomadsen
KeymasterHi,
Yup because the update event _must_ have access to several internal resources, while at the same time it may run slightly async to the destruction of the smart binding instance. Hence the update event has the responsibility of releasing some stuff when it ends.
I did not anticipate people wanting to deactivate the update event at any time, however I appreciate that it may be a wish in certain circumstances, why I (as mentioned in a different reply) have made a change that should fix it and leave the resources be, until it is really during a smart binding instance shutdown.
/Kim
-
-
AuthorPosts
- You must be logged in to reply to this topic.
