Page 1 of 1

Standalone doesn't quit on first launch

Posted: Tue Apr 17, 2018 3:27 pm
by trevix
Hi all. Thanks for the eventual help.

My standalone (OSX10.12.6 LC 8.1.9) on the the file menu has a command to quit :

Code: Select all

...
     case "Esci"
      case "Exit"
      case "Quit"
      case "Quit Tcal"
         doFileQuit
         break
   end switch
end menuPick
The doFileQuit command (on the main stack), is this:

Code: Select all

on doFileQuit
   set the defaultstack to "Tcal" --main stack
   lock messages
   
   --close all sockets
   if the openSockets <> empty then 
      repeat for each line tSock in the opensockets
         close socket tSock
      end repeat
   end if

   --close the stacks in this application:
   put the stacksInUse into myStacks
   repeat for each line myStack in myStacks
      stop using stack myStack
   end repeat
   
   -- stacks
   put the openStacks into myStacks
   put "Tcal,message box,home,tool,Message Box,revTools,revMenubar" & comma & the short name of me into myDontClose
   repeat for each line myStack in myStacks
      if myStack is not among the items of myDontClose then close stack myStack
   end repeat
   
   -- messages
   put the pendingmessages into myMsgs
   repeat for each line myMsg in myMsgs
      cancel item 1 of myMsg
   end repeat
   close me --not sure about this but deleting it doesn't make a difference
   if the environment is not "development" then
      quit
   end if
end doFileQuit
What is happening is that, on the first launch after its creation, when I quit from the menu, the stack become invisible but the standalone is still running ("app not responding" on the activity monitor) and I must force quit.
The second time I run the standalone, it quits fine.

I tried also to put a "Quit" directly on the menuPick (bypassing the doFileQuit). Also saving to a text file reports on different parts of the doFileQuit script (everything runs fine).
And there is no shutdownRequest anywhere on the stacks.

I don't know what else to try, in order to trace what's happening, since I cannot really trace the "quit" on development.
Any Idea?

Trevix

Re: Standalone doesn't quit on first launch

Posted: Tue Apr 17, 2018 3:55 pm
by LiveCode_Panos
Hi Trevix,

Maybe a runtime error occurs in the IDE and it fails silently, causing the execution to stop (thus it does not quit).

try to <put true into grevdevelopment> and test again. If this is what happened, now the error will be thrown rather than failing silently.

Best,
Panos
--

Re: Standalone doesn't quit on first launch

Posted: Tue Apr 17, 2018 5:42 pm
by trevix
Thansk for answering.

I modified the menu as this:

Code: Select all

...
   case "Esci"
      case "Exit"
      case "Quit"
      case "Quit Tcal"
         put true into grevdevelopment
         Quit
         break
   end switch
end menuPick
and I intercept errors in the main stack with this:

Code: Select all

on errorDialog pExecutionError
   local Thelook
   if pExecutionError is not empty then
      put gTCdialogs[236] & cr & cr into TheMessage
      put "DEBUG: " & the internet date & return & "An error occurred on line: " & item 2 of line 1 of pExecutionError \
            & return & "in handler: " & item 4 of line 3 of pExecutionError & return \
            & "in script: " & item 4 of line 4 of pExecutionError & return  Into TheBug
      put pExecutionError & return  after TheBug
      put "Default stack: " & the defaultstack & return  after TheBug
      --set the clipboardData to Thelook; beep
      Answer TheMessage & TheBug  with "Cancel" or "Send" titled "Execution Error"
      put TheBug into gTheBug --into global for later user
      if it = "Send" then
         CallHome TheBug 
      end if
   end if
end errorDialog
Still, quitting from the menu on FIRST launch only does not quit the standalone (and need a force quit)
Is this how you intended the use of gRevDevelopment ?

Re: Standalone doesn't quit on first launch

Posted: Wed Apr 18, 2018 11:13 am
by trevix
Update.

Running in the IDE this script (from msg) does the same as the standalone: LC disappears silently, but does not quit (need a force quit).
Should I file a Bug?

Code: Select all

--on quitting the app from the menu
on doFileQuit
   put true into grevdevelopment
   try
      quit
   catch tErrVar
      answer tErrVar
   end try
...

Re: Standalone doesn't quit on first launch

Posted: Wed Apr 18, 2018 12:12 pm
by LiveCode_Panos
Hi Trevix,

Thanks for the follow up. Yes please, if you could file a bug and attach a sample stack it would be great.

If you only see that with your confidential stack, feel free to email it directly to panos.merakos at livecode dot com

Best,
Panos
--

Re: Standalone doesn't quit on first launch

Posted: Wed Apr 18, 2018 6:26 pm
by trevix
See bug 21217