Recent

Author Topic: problem for exiting from an app that use UOS  (Read 4413 times)

Lulu

  • Full Member
  • ***
  • Posts: 226
problem for exiting from an app that use UOS
« 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
Thanks

EDIT:  I've changed sleep(500) to sleep(1000) and the exception doesn't raise any more
« Last Edit: December 07, 2021, 10:02:06 pm by Lulu »
wishing you a nice life

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: problem for exiting from an app that use UOS
« Reply #1 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
« Last Edit: December 08, 2021, 01:22:27 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Lulu

  • Full Member
  • ***
  • Posts: 226
Re: problem for exiting from an app that use UOS
« Reply #2 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 !
wishing you a nice life

 

TinyPortal © 2005-2018