What happens with CEF application on ENDSESSION?
Posted: Mon Feb 10, 2020 5:23 pm
I was doing alot of restart testing of my app the other day and I got an Access Violation exception (not always, but occasionally) when restarting windows while my app was running.
The error seemed to be happening in DestroyGlobalCEFApp;
As we know, DestroyGlobalCEFApp is simply: if (GlobalCEFApp <> nil) then FreeAndNil(GlobalCEFApp);
My own app will repsond to WM_QUERYENDSESSION with Msg.Result := 0 ('No') and send itself a WM_CLOSE message in order to perform an orderly application close.
As a fix, I put DestroyGlobalCEFapp in a try..except block to suppress the exception and never saw the issue again, but that does not feel right.
I could not find any CEF4Delphi code related to WM_QUERYENDSESSION, but one theory I have is that CEF could be doing something, or maybe Windows is forcably killing the CEF app independently at the same time, and my call to FreeAndNil(GlobalCEFApp) sometimes causes an Access Violation.
R Greg Dawson
The error seemed to be happening in DestroyGlobalCEFApp;
As we know, DestroyGlobalCEFApp is simply: if (GlobalCEFApp <> nil) then FreeAndNil(GlobalCEFApp);
My own app will repsond to WM_QUERYENDSESSION with Msg.Result := 0 ('No') and send itself a WM_CLOSE message in order to perform an orderly application close.
As a fix, I put DestroyGlobalCEFapp in a try..except block to suppress the exception and never saw the issue again, but that does not feel right.
I could not find any CEF4Delphi code related to WM_QUERYENDSESSION, but one theory I have is that CEF could be doing something, or maybe Windows is forcably killing the CEF app independently at the same time, and my call to FreeAndNil(GlobalCEFApp) sometimes causes an Access Violation.
R Greg Dawson