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 

Property sheet crash
Goto page Previous  1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Wed Feb 07, 2018 12:33 am    Post subject: Re: Reply with quote

PaulLaidler wrote:
At the very least I recommend that you change all the callback return values from 1 to 2

Dan,

I think this may be very useful advice, as a call back response of 1 can do a lot of unnecessary screen updates. I am in the process of implementing this change to respond to other devilry I have located. You may see my recent post of problems when using export_image@. It wasn't this routine as I did some changes to file open/close and I scared off the devilry (for the moment). I am now cleaning up the interrupt responses throughout the program.

John
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Wed Feb 07, 2018 7:19 am    Post subject: Reply with quote

John, Thanks for reminding as I often do not care about this. After checking the code it looks like I have done that for all functions called by %PS couple years back when this issue with them =1 or =2 surfaced. And since this did not change anything of course I'm kind of semi-forgot about this. May still miss this somewhere in damn amount of used functions. Will try to enforce further cleaning searching around "end function" statements when I will have sleeping difficulty Smile
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Feb 07, 2018 10:53 am    Post subject: Reply with quote

One other thought...

If a "Settings" dialog is somehow causing instability because of multiple calls to callback functions then you could consider forming a more stable environment by creating the "Settings" dialog just once. You would hide this dialog instead of closing/destroying it and show it rather than recreate it. In this way the connection between this dialog and its variables in your code would be fixed and permanent. In theory it ought to make no difference but there is apparently something nasty going on because of the way in which your callbacks are interacting.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Thu Feb 08, 2018 10:40 am    Post subject: Re: Reply with quote

PaulLaidler wrote:
One other thought...

If a "Settings" dialog is somehow causing instability because of multiple calls to callback functions then you could consider forming a more stable environment by creating the "Settings" dialog just once. You would hide this dialog instead of closing/destroying it and show it rather than recreate it. In this way the connection between this dialog and its variables in your code would be fixed and permanent. In theory it ought to make no difference but there is apparently something nasty going on because of the way in which your callbacks are interacting.


Paul, I use opening and closing property sheet to save settings after changing something. By the way, how to hide the entire window?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Feb 08, 2018 4:17 pm    Post subject: Reply with quote

The simple and direct way is to call the Windows API ShowWindow.

Code:
include <windows.ins>
integer ir
integer(7) hwnd
ir = ShowWindow(hwnd, SW_SHOW)
ir = ShowWindow(hwnd, SW_HIDE)
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Thu Feb 08, 2018 8:48 pm    Post subject: Reply with quote

Cool, will play with this option too. Thanks, Paul
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue May 22, 2018 7:50 am    Post subject: Reply with quote

Dan

A bug has been identified in the ClearWin+ code for %ps and this is likely to be the cause of the failure. I will post a message when a new set of DLLs becomes available. I can do this soon as long as it is understood that there will be no significant changes for %pl and %fr.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Wed May 23, 2018 11:34 pm    Post subject: Reply with quote

This was the most annoying bug in Clearwin, true devilry. "Was", if it really was catched, I cross my fingers. What could be more bad then to have the bug which disappears when you start the program inside the debugger?

It disappears in debugger even if you compile the code with /nocheck , so this is how I used the code for more then a decade, always running it via debugger. And this is how I discovered that besides of this error the debugger is actually very very useful.


Last edited by DanRRight on Thu May 24, 2018 4:23 pm; edited 1 time in total
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Thu May 24, 2018 3:24 am    Post subject: Reply with quote

I don't believe that by running anything in the debigger solves a problem. It might hide it away somewhere, or simply just not flag it, but it's still there !
What it does to your program, now that is the 64000 dollar question.

It's like rust on your car, you can paint over it but one day your car will fall apart - and when you least expect it !!! LOL
_________________
''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... Smile "
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Fri May 25, 2018 6:58 am    Post subject: Reply with quote

Of course for this exact problem debugger did not find the bug, it was hiding it out at least I was able to run the code
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Sun Jan 31, 2021 6:31 am    Post subject: Reply with quote

Here is shortest version of crash of property sheet. This could be not the same as in my large code where property sheet crashes but it still crashes and it should never do that no matter what. Of course i can make it not crashing by the tricks but the point is not to hide but to find this very deeply hidden reason for the crashes.
Hints:
1) If you add SAVE statement it does not crash (my larger code still crashes). Same if you compile it with /SAVE it does not crash (but again my larger code still crashes. The only way to make my larger code not to crash is to run it via SDBG even if it compiled with /NOCHECK and /OPTIMIZE. This does not influences its speed but creates an obvious inconvenience to always use SDBG)
2) If you remove kpol6 and associated %rd it does not crash
3) if you compile it with the /check it will inform that you forgot to define some values. Behavior though is the same like with or without kpol6
4) if you substitute one line in main program with another (uses button to call property sheet) it does not crash
5) If you compile my larger code with /undef it does not reveal any problems still it crashes. So the problem is most probably inside the property sheet source code

Code is in the next post

/* Didn't I mention before that anyone who is not using property sheet is losing a lot and their programs most probably look like sh#t and are barely usable?


Last edited by DanRRight on Sun Jan 31, 2021 6:51 am; edited 10 times in total
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Sun Jan 31, 2021 6:32 am    Post subject: Reply with quote

CONTINUE from previous page.

COMPILING: FTN95 aaa.f95 /link or FTN95 aaa.f95 /link /check

Code:
module mod1
INCLUDE <clearwin.ins>

integer:: kpol1=1, nAxialSlices=1, n_CurrSheetSettings=1, kPrintScreenLoadedDensity=1
integer (7) khwCtrlSettingsMain
real*8 SIZEINCRFORZ1

Contains

   integer*4 function MainSettings ()
!         save

!....... one of sources of Access Violation if n_CurrSheetSettings not set (= 1)

        i=winio@('%sy[3d_raised]&')
        i = winio@('%ca[&Main]&')
        i = winio@('%sh',ish1)

        i = winio@('%ca[&Selection]&')
      i=winio@('%1.3ob[raised]&')

i=winio@(' nAxialSlices %ta%9rd%ff&', nAxialSlices)

      i=WINIO@('%cb&')

i=winio@(' Factor and RGBA Colors to highlight Z1%ta%9rf %ff&', SizeIncrForZ1)

      i=WINIO@('%cb&')

i=winio@(' Print after read densities to text window %ta%rb[PrintScreen Density]%ff&', kPrintScreenLoadedDensity)

      i=WINIO@('%cb&')
   
   
        i = winio@('%sh',ish2)

        i = winio@('%ca[&Palette]&')
        i = winio@('%sh',ish3)
 
        i = winio@('%ca[Tab3]&')
        i = winio@('%sh',ish4)

        i = winio@('%ca[&After 4]&')
        i = winio@('%sh',ish5)

        i = winio@('%ca[Debug]&')
!   if remove kpol6   - not crashing
   I = winio@('kpol1 ... 6 %ta%4rd%4rd%4rd%4rd%4rd%4rd %ff&', kpol1, kpol2, kpol3, kpol4, kpol5, kpol6)
        i = winio@('%sh',ish6)

        i = winio@('%ca[Vol]&')
        i = winio@('%sh',ish7)

        i = winio@('%ca[Misc]&')
        i = winio@('%sh',ish8)

        i = winio@('%ca[Res.]&')
        i = winio@('%sh',ish9)

        i = winio@('%ca[Res2]&')
        i = winio@('%sh',ish10)

        i = winio@('%ca[Res3]&')
        i = winio@('%sh',ish11)

        i = winio@('%^`11ps&',ish1, ish2, ish3, ish4, ish5, ish6,&
     &  ish7, ish8, ish9, ish10, ish11,   &
     &  n_CurrSheetSettings, cbupdateSettings)

        i = winio@('%ww%bg[gray]&')

   i = winio@('%ac[Esc]&',   'exit')
   i = winio@('%ac[Alt+X]&', 'exit')

        i = WINIO@('%ff%cn%6`^bt[&OK]   %6^bt[&Cancel]&',&
     &  'set', lwCtrlSettingsMain, 0,&
     &  'set', lwCtrlSettingsMain, 0)

        m = WINIO@('%hw&', khwCtrlSettingsMain)
        m = WINIO@('%lw', lwCtrlSettingsMain)
10000   MainSettings = 2
   end function
!....................................................
INTEGER*4 FUNCTION cbupdateSettings()
   call see_propertysheet_page@ (n_CurrSheetSettings)
   cbupdateSettings=2
end function
end module mod1
!====================================================
Program CrashingPS
use mod1

!.... With this line it crashes
i=winio@('%mn[File[Settings]]%es', MainSettings ) ! variant1    crashes

!.... With this line instead previous one - not crashing
!i=winio@('%ww%^bt[Settings]%es', MainSettings ) ! variant2 not crashing

end program
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Sun Jan 31, 2021 7:35 am    Post subject: Reply with quote

Dan,

Your example is beyond my comprehension, especially with the selection of accelerator keys.
I am finding that by changing to the following I am changing the response. Basically I declared all the variables used in the table as static (save) in the module. (I could/should have also given them an initial value?)
You have these variables dynamic and so re-allocated on the stack for each call to MainSettings, with no initialisation. Does this make sense ?
Code:
module mod1
INCLUDE <clearwin.ins>

integer:: kpol1=1, nAxialSlices=1, n_CurrSheetSettings=1, kPrintScreenLoadedDensity=1
integer (7) :: khwCtrlSettingsMain  ! ,lwCtrlSettingsMain not needed ?
real*8 SIZEINCRFORZ1

  integer :: ish1,ish2,ish3,ish4,ish5,ish6,ish7,ish8,ish9,ish10,ish11
  integer :: kpol1, kpol2, kpol3, kpol4, kpol5, kpol6, lwCtrlSettingsMain


I don't understand the definition of call-back function in the following, but this might not be relevant ?
Code:
        i = WINIO@('%ff%cn%6`^bt[&OK]   %6^bt[&Cancel]&',&
     &  'set', lwCtrlSettingsMain, 0,&
     &  'set', lwCtrlSettingsMain, 0)
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Sun Jan 31, 2021 8:11 am    Post subject: Reply with quote

John,

Thanks for trying. Please confirm that my code crashes with your set of compiler/computers.

If i initialize all kpol variables the %PS does not crash but the point is that something will always will be not initialized, some elements of arrays for example, when your property sheet will become super large. And it will crash.

For example I do not know what is not initialized in my larger code, everything is checked many times in decade, but one of my property sheets crashes 100% if not run via SDGB. I do not know what specifically SDBG may do with the code compiled with /nocheck but it 100% prevents property sheet from crashing - this is good hint for SF to check. I hope SF will somehow make some traps for the attempts of %PS to crash.

Clearwin code has never crash no matter what the error. For example OpenGL was made such a way that it never crashes. It may not plot anything if something is wrong, arrays violated, request to plot requires too much time and resources to complete etc, it will leave the screen black so you will be able to retry the plot but it will never crash

My 1 year old version of Clearwin still not always checks for all cases of uninitialized variables (can not install newest version because a lot of programs are permanently running), for example it does not check for SIZEINCRFORZ1 above. It might not check for some other cases and looks like %PS is sensitive to uninitialized stuff it handles

The " 'set', lwCtrlSettingsMain, 0 " is similar to "EXIT" if you use %lw. I often use %lw in my codes to allow them to continue their run like nothing happened while you open property sheet and do something in it in parallel. Otherwise without %lw when you open property sheet the code run will stop and wait till you exit it. The %lw is useful in many other situations, for example when the warning will pop to inform you about something without stopping the code. You will close the warning window when necessary, or it will close itself or fade away after some time you define
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Sun Jan 31, 2021 8:37 am    Post subject: Reply with quote

Dan,

Not sure what crash is ?

With your code, when I go to file>settings>debug I get:
"A variable for %rd has not been given an initial value.
Do you want to continue? Click No to abort."

I select Yes and do this 5 or 6 times and get to the menu.
repeating the process sees the modified values lost, which confirms my suspicions.

(not sure if this version has kpol6 listed, as kpol6 is required for my modified code.)

Also my default compile initially falied, as I have /implicit_none in ftn95.cfg but compiled as ftn95 aa2.f90 /link /check /-imp ( This suggested the problem I identified)

There may be other problems I am not identifying ?



With the modified module, the program appeared to run as required.
( so not /64 and integer(7) problems )
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
Goto page Previous  1, 2, 3, 4, 5  Next
Page 3 of 5

 
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