kbmMWClientConnectionPool1 can’t free.

Home Forums kbmMW kbmMWClientConnectionPool1 can’t free.

Viewing 6 reply threads
  • Author
    Posts
    • #56381
      TomYU
      Participant

      hi,

      create a blank fmx project, put a kbmMWClientConnectionPool1 on form, run on android.

      app not close.

      code:

      unit Unit1;

      interface

      uses
      System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
      FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
      kbmMWCustomConnectionPool, kbmMWClientDataset, FMX.Controls.Presentation,
      FMX.StdCtrls;

      type
      TForm1 = class(TForm)
      kbmMWClientConnectionPool1: TkbmMWClientConnectionPool;
      Button1: TButton;
      procedure Button1Click(Sender: TObject);
      private
      { Private declarations }
      public
      { Public declarations }
      end;

      var
      Form1: TForm1;

      implementation

      {$R *.fmx}

      procedure TForm1.Button1Click(Sender: TObject);
      begin
      kbmMWClientConnectionPool1.Free;
      end;

      end.

      • This topic was modified 3 years, 9 months ago by TomYU.
    • #56401
      kimbomadsen
      Keymaster

      Hi,

      I would not expect a component owned by the form to be manually freed. What happens if you instantiate it without ownership and then free it?

      /Kim

    • #56411
      TomYU
      Participant

      hi,

      I did this just to redisplay the problem.
      When the application is closed, because this component cannot be released normally, the application cannot exit normally. When the application is restarted, the application is stuck.
      This is a problem on the Android platform.

      best regards

      Tom YU.

       

    • #56413
      TomYU
      Participant

      When the application is closed, kbmMWClientConnectionPool1 will be released.

      and kbmMWClientConnectionPool1 will execute the following methods:
      FRefreshScheduler. StopScheduling;
      On the Android platform, this line of code is frozen and will not continue.

      So the application can’t exit normally!

      fixed code:

      procedure TkbmMWPooledDatasetRefreshScheduler.StopScheduling;
      begin
      if FThread.IsStarted then//add by Tom YU
      FThread.Pause;
      end;

      I don’t know if this correction is correct, but my application can be closed normally.

      best regards

      Tom YU.

       

    • #56414
      TomYU
      Participant

      As a new development, I found that the code implemented in this way can execute normally on android platform.

      procedure TForm1.Button2Click(Sender: TObject);
      begin
      rs:=TkbmMWPooledDatasetRefreshScheduler.Create(Self);
      rs.StopScheduling; //not frozen when TkbmMWPooledDatasetRefreshScheduler.Owner<>nil.
      rs.Free;
      rs:=nil;
      end;

    • #56415
      TomYU
      Participant

      The pause method does not work as expected on the Android platform:

      procedure TkbmMWCustomThread.Pause;

    • #56416
      TomYU
      Participant

      Default compilation variables used:
      {$DEFINE KBMMW_SUPPORT_FASTMRWSLOCK} // If to use native very fast Multiple Reader Exclusive Writer lock.

Viewing 6 reply threads
  • You must be logged in to reply to this topic.