forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

%cc exit from main window

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Tue Dec 30, 2008 11:17 am    Post subject: %cc exit from main window Reply with quote

I'm having a problem with exitting from a program. The main window has a %cc with a callback function EndExit_FUNCTION which gives an opportunity to cancel the exit or save data first. Here it is:

Code:
       INTEGER FUNCTION EndExit_FUNCTION()

       INCLUDE <WINDOWS.INS>
       EXTERNAL       File_FUNCTION
       COMMON/GREYS/  MGR(10)
       CHARACTER*(129)      FILENM
       COMMON  /FILES/      FILENM

       IF (MGR(3) .NE. 0 .OR. MGR(4) .NE. 0) THEN
       EndExit_FUNCTION = 1
       IA=WINIO@('%ca[Quit using Program XXX]&')
       IA=WINIO@('%mi[ICON_2]&')
       IA=WINIO@('%si?   Do you want to save your data first?   &')
       IA=WINIO@('%ff%nl%cn%6^`bt[Yes]     %6bt[No]     %6bt[Cancel]',
     &                '+','FILE_OPENW',Filenm,FILE_FUNCTION,'EXIT')
       IF (IA .EQ. 3) RETURN
           ENDIF
       EndExit_FUNCTION = 0
       RETURN
       END


Button 1 (Yes) launches the routine to save the current data (FILE_FUNCTION); Button 2 (No) sets the return code to 0, which closes the main window, whereas button 3 (Cancel) sets the return code to 1 so that the main window behaves as if nothing happened, and doesn't close.

Under certain circumstances in my rather large program, which are repeatable, exitting causes an error of the type: The instruction at 00401c01 attempted to write to location fffffedc in file ss.for at line 350, which is the last executable line in the main routine with
Code:
IA=WINIO@('%sf')

Most of the time, exit occurs as intended. The program has no other windows open.

The repeatable conditions occur when a particular toolbar button is selected (%tb) and the big graphics area in the main window accordingly displays a particular set of things.
I've tried ending the main window WINIO@ sequence with different things, but to no avail. MGR(3) and (4) are both 1 when it works and when it doesn't - I've checked, even though the window in this routine wouldn't appear if neither was 1.

Am using FTN95 4.90

Has anyone any ideas?

Eddie
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Tue Dec 30, 2008 12:57 pm    Post subject: Reply with quote

Maybe just knowing how to suppress the error message would do. This only occurs when I'm exitting the program, after all ! I tried compiling the main routine with /HARDFAIL and that didn't help.

Eddie
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Tue Dec 30, 2008 8:41 pm    Post subject: Reply with quote

If you were to provide a simple main program I may be able to help.
As it is I have not managed to reproduce the problem.

My guess is that you are accessing memory that has been released.
As a quick test, try using /SAVE on the compile command line.
If this works you will need to find out which variable needs the SAVE attribute and remove /SAVE from the command line.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Thu Jan 01, 2009 8:50 pm    Post subject: Reply with quote

Paul,
Your suggestion worked, thanks. I thought I didn't need SAVE in a program unit, and I can't find any non-COMMON variables in it. I never rely on values persisting across subprogram invocations (not knowingly) so have always regarded SAVE as a bit unnecessary.

Day 1 of 2009 and this old dog has learnt a new trick!

Eddie
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Fri Jan 02, 2009 10:31 am    Post subject: Reply with quote

ClearWin+ uses addresses (for example in window_update@). It also uses the Windows message queue which (being a queue) can have a delayed response. It is conceivable that ClearWin+ might try to update the contents of an address after the associated subprogram has exited.

If your problem is reproducible and you can illustrate it in a small but complete program then you can post it here and we will see if we can get ClearWin+ to avoid the crash.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Fri Jan 02, 2009 4:03 pm    Post subject: Reply with quote

I'll see if I can get it to happen in a small program, but I suspect that it only happens in complicated situations. I can only find 3 local variables in the main program. If they are all explicitly put into a SAVE statement, that doesn't help. A global SAVE does.

Eddie
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group