Tokay Posted May 17, 2021 Share Posted May 17, 2021 Stop event from the system called the OnStart event in the TUniGUIService component. I look in the IDE and see that call stack: Vcl.SvcMgr.TService.DoStop TUniGUIService._StopEvent TTestService.UniGUIServiceStart Please look at the issue urgently. Without correct stopping I could not work correctly in the service mode! I have Delphi XE6, Windows 10, UniGUI 1545 env. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted May 17, 2021 Administrators Share Posted May 17, 2021 Hello, Can you elaborate more? Do you call stop inside the OnStart event? Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted May 17, 2021 Administrators Share Posted May 17, 2021 Please send your code. Quote Link to comment Share on other sites More sharing options...
Tokay Posted May 17, 2021 Author Share Posted May 17, 2021 I'll try to reproduce on the clean project Quote Link to comment Share on other sites More sharing options...
Tokay Posted May 17, 2021 Author Share Posted May 17, 2021 unit ServiceModule; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs, uniGUIService, System.IOUtils; type TUniServiceModule = class(TUniGUIService) procedure UniGUIServiceDestroy(Sender: TObject); procedure UniGUIServiceCreate(Sender: TObject); procedure UniGUIServiceStart(Sender: TService; var Started: boolean); procedure UniGUIServiceStop(Sender: TService; var Stopped: boolean); private { Private declarations } protected procedure InitService; override; public { Public declarations } function GetServiceController: TServiceController; override; end; var UniServiceModule: TUniServiceModule; implementation {$R *.dfm} uses UniGUIVars; procedure ServiceController(CtrlCode: DWord); stdcall; begin UniServiceModule.Controller(CtrlCode); end; procedure TUniServiceModule.UniGUIServiceDestroy(Sender: TObject); begin TFile.AppendAllText('D:\Temp\log.txt', 'Destroy' + #13#10); end; procedure TUniServiceModule.UniGUIServiceCreate(Sender: TObject); begin TFile.AppendAllText('D:\Temp\log.txt', 'Create' + #13#10); end; function TUniServiceModule.GetServiceController: TServiceController; begin Result := ServiceController; end; procedure TUniServiceModule.InitService; begin SetServerClass(UniGUIServerModuleClass); end; procedure TUniServiceModule.UniGUIServiceStart(Sender: TService; var Started: boolean); begin TFile.AppendAllText('D:\Temp\log.txt', 'Start' + #13#10); Started := True; end; procedure TUniServiceModule.UniGUIServiceStop(Sender: TService; var Stopped: boolean); begin TFile.AppendAllText('D:\Temp\log.txt', 'Stop' + #13#10); Stopped := True; end; end. Create Start Start (comment: it's wrong, must be Stop) Destroy This is code and result of how it works (the service was started after finished). Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted May 18, 2021 Administrators Share Posted May 18, 2021 Checking... Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted May 18, 2021 Administrators Share Posted May 18, 2021 procedure TUniGUIService._StopEvent(Sender: TService; var Stopped: Boolean); begin if Assigned(FOnStop) then FOnStart(Sender, Stopped); if Stopped then FreeAndNil(FServerInstance); end; Found the problem. In computer science it is called the Copy/Paste bug and it is root of all errors! It will be fixed in the next build! 1 1 Quote Link to comment Share on other sites More sharing options...
Tokay Posted May 18, 2021 Author Share Posted May 18, 2021 Great! Thank you and waiting for fix. Quote Link to comment Share on other sites More sharing options...
Tokay Posted July 5, 2021 Author Share Posted July 5, 2021 Fixed in the latest 1550, thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.