Lazarus

Programming => Graphics and Multimedia => Audio and Video => Topic started by: Lulu on December 07, 2021, 06:13:05 pm

Title: problem for exiting from an app that use UOS
Post by: Lulu on December 07, 2021, 06:13:05 pm
Hello Fred,
Thanks you for sharing your UOS project !
I played a little with the example 'simpleplayer_noflat' and when I exit the application sometime it appear an SIGSEGV exception. I see in your code that you use Sleep before freeing the player:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormDestroy(Sender: TObject);
  2. begin
  3.   if (button3.Enabled = False) then
  4.   begin
  5.     button6.Click;
  6.     sleep(500);          // <<<<<
  7.   end;
  8.   if button1.Enabled = False then
  9.   begin
  10.     PlayerIndex1.Free;
  11.     uos_free;
  12.   end;
  13. end;
  14.  
Is Sleep here to wait for the termination of the thread used by Tuos_Player ?
If yes, could you implement please, a proper way to quit the application without this problem ?
Searching in this forum I found this link, may be it can help.
https://forum.lazarus.freepascal.org/index.php/topic,39761.msg273898.html (https://forum.lazarus.freepascal.org/index.php/topic,39761.msg273898.html)
Thanks

EDIT:  I've changed sleep(500) to sleep(1000) and the exception doesn't raise any more
Title: Re: problem for exiting from an app that use UOS
Post by: Fred vS on December 08, 2021, 12:30:35 pm
Hello Lulu.

I strongly recommend to use uso_flat.pas for your applications.
All the demos in /uos/examples/ use uos_flat.pas (apart the one you tried and you did see the possible problems).

uos_flat.pas does care of creation and destroy of players and many other things.

Is there a reason why you prefer to not use uos_flat.pas ?

There is a uos forum who centralizes all the questions, you are welcome there.
http://uos-forum.108.s1.nabble.com/

Thanks.

Fre;D
Title: Re: problem for exiting from an app that use UOS
Post by: Lulu on December 08, 2021, 02:23:21 pm
Thanks you Fred for your answer.
There is no reason to use uos instead of uos_flat. Ok, I continue my uos journey on another example !
The forum is interesting, thanks !
TinyPortal © 2005-2018