[Lazarus] animated splash screen for lengthy operation, works with windows, doesn't with linux

Luca Olivetti luca at wetron.es
Mon Mar 27 17:37:35 CEST 2023


El 27/3/23 a les 17:26, Luca Olivetti via lazarus ha escrit:
> El 27/3/23 a les 16:50, Michael Van Canneyt ha escrit:
> 
>>>>
>>>> Ehm. In case of an exception, ut will never be freed ?
>>>
>>> That's what I said.
>>> I was looking for a way to free it *and* raise the exception in the 
>>> context of the main thread.
>>> If I move the ut.free before the raise, the exception has already 
>>> been freed and it's invalid, causing a sigsev, if I enclose it in a 
>>> try..finally the exception handler will be called after the finally 
>>> has freed the thread (and the exception, so it's the same problem).
>>
>> Normally, I'd do
>>
>> Raise 
>> Exception(ut.fatalexception.classtype).Create(ut.fatalexception.message);
> 
> Actually I'd have to first create the exception, then free ut, then 
> raise the exception (keep in mind that FatalException is a TObject and 
> it isn't necessarily of class Exception), otherwise a direct raise as 
> you wrote would not free ut.
> 
>    MyException:=nil;
>    if ut.FatalException<>nil then
>    begin
>       if ut.FatalException is Exception then
> 
> MyException:=Exception(ut.FatalException).Create(Exception(ut.FatalException).message)

Ouch, I left out the ClassType, but if I change it to

 
MyException:=Exception(Exception(ut.FatalException).ClassType).Create(Exception(ut.FatalException).message)

it's an instant segfault.

Bye

-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007



More information about the lazarus mailing list