Skip to content
This repository has been archived by the owner on Oct 31, 2020. It is now read-only.

Commit

Permalink
dorestartfmd, cleanup related to d148344
Browse files Browse the repository at this point in the history
error when closing sqlite3 database causing unhandled exception on destroy event. therefore it never reach dorestartfmd call
  • Loading branch information
dazedcat19 committed Apr 10, 2020
1 parent d148344 commit c8841b7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
19 changes: 1 addition & 18 deletions baseunits/FMDOptions.pas
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,6 @@ procedure RestartFMD;
procedure DoRestartFMD;
var
p: TProcessUTF8;
{$ifdef windows}
current_handle: String;
wait_handle_counter: Integer;
{$ifend}
begin
p := TProcessUTF8.Create(nil);
try
Expand All @@ -374,25 +370,12 @@ procedure DoRestartFMD;
p.InheritHandles := False;
p.Parameters.AddStrings(AppParams);
{$ifdef windows}
current_handle := IntToStr(Integer(Application.Handle));
p.Parameters.Add('--dorestart-handle=' + current_handle);
p.Parameters.Add('--dorestart-handle=' + IntToStr(Integer(Application.Handle)));
{$ifend}
p.Execute;
finally
p.Free;
end;
{$ifdef windows}
// make sure it's running
current_handle := FMD_DIRECTORY + PathDelim + current_handle + '_handle';
wait_handle_counter := 0;
while not FileExists(current_handle) do
begin
sleep(250);
Inc(wait_handle_counter, 250);
if wait_handle_counter > 10000 then Exit;
end;
DeleteFile(current_handle);
{$ifend}
end;

procedure doInitialization;
Expand Down
4 changes: 0 additions & 4 deletions mangadownloader/md.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@
doRestartHandle:=THandle(StrToIntDef(AppParams.Values['--dorestart-handle'],-1));
if Integer(doRestartHandle)<>-1 then
begin
try
FileClose(FileCreate(FMD_DIRECTORY+PathDelim+IntToStr(doRestartHandle)+'_handle'));
except
end;
// remove previous --dorestart-handle from params
AppParams.Delete(AppParams.IndexOfName('--dorestart-handle'));
while IsWindow(doRestartHandle) do
Expand Down

0 comments on commit c8841b7

Please sign in to comment.