今天遇到奇怪的问题,在线程中建立一个TkbmMWClientQuery的临时对象q,及一个TkbmMWBinaryStreamFormat的临时对象bsf,第一次执行正常,再次执行时一直等待,也不产生异常,最后发现原来用q.DisposeOf,bsf.DisposeOf释放对象产生的问题,改成Free正常了,kbmMW版本5.08.10.
procedure TMainForm.Rectangle1Click(Sender: TObject); var url: string; begin CCLoadingIndicator1.ShowLoadingIndicator; Scheduler.Run( procedure var bsf: TkbmMWBinaryStreamFormat; q: TkbmMWClientQuery; begin bsf := TkbmMWBinaryStreamFormat.Create(nil); q := TkbmMWClientQuery.Create(nil); try //执行查询任务 finally bsf.DisposeOf; q.DisposeOf; end; end).SynchronizedAfterRun( procedure begin //同步界面操作 CCLoadingIndicator1.HideLoadingIndicator; end).Activate; end;
上面代码,在kbmMW 5.09.00下正常了!