|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
DanRRight
Joined: 10 Mar 2008 Posts: 2867 Location: South Pole, Antarctica
|
Posted: Thu Feb 08, 2018 10:40 am Post subject: Re: |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8018 Location: Salford, UK
|
Posted: Thu Feb 08, 2018 4:17 pm Post subject: |
|
|
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 |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2867 Location: South Pole, Antarctica
|
Posted: Thu Feb 08, 2018 8:48 pm Post subject: |
|
|
Cool, will play with this option too. Thanks, Paul |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8018 Location: Salford, UK
|
Posted: Tue May 22, 2018 7:50 am Post subject: |
|
|
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 |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2867 Location: South Pole, Antarctica
|
Posted: Wed May 23, 2018 11:34 pm Post subject: |
|
|
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 |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2867 Location: South Pole, Antarctica
|
Posted: Fri May 25, 2018 6:58 am Post subject: |
|
|
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 |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2867 Location: South Pole, Antarctica
|
Posted: Sun Jan 31, 2021 6:31 am Post subject: |
|
|
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 |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2867 Location: South Pole, Antarctica
|
Posted: Sun Jan 31, 2021 6:32 am Post subject: |
|
|
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 |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2587 Location: Sydney
|
Posted: Sun Jan 31, 2021 7:35 am Post subject: |
|
|
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 |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2867 Location: South Pole, Antarctica
|
Posted: Sun Jan 31, 2021 8:11 am Post subject: |
|
|
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 |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2587 Location: Sydney
|
Posted: Sun Jan 31, 2021 8:37 am Post subject: |
|
|
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 |
|
|
Kenneth_Smith
Joined: 18 May 2012 Posts: 717 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Sun Jan 31, 2021 11:28 am Post subject: |
|
|
Dan, I replicated your crash with 11 sheets. Removing the 11th sheet from the code and the crash is eliminated. I wonder if there may perhaps be a maximum of 10 permitted sheets with the coding of the DLL? Paul may have a view on that.
Ken |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1897
|
Posted: Sun Jan 31, 2021 12:59 pm Post subject: |
|
|
I compiled and linked Dan's code using FTN95 8.70 with /opt /p6. I then ran the resulting program, then clicked on File->Settings; in the new tabbed window that popped up, I clicked the radio-button Selection->PrintScreen Density, then Ok.
At this point I received an Access Violation window, "The instruction at address 00000000 attempted to read from location 00000000".
I then repeated all the steps above, but with /64 instead of /p6. The resulting EXE did not crash this time. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2393 Location: Yateley, Hants, UK
|
Posted: Sun Jan 31, 2021 11:24 pm Post subject: |
|
|
Quote: | * 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? | ... Dan
I have never been able to make property sheets work, nor half a dozen other CW+ facilities, and have managed to work around without them. CW+ doesn't have some facilities that would be useful, and have managed to work around their absence. Windows evolution makes some things that looked great when developed, but a few years later look very dated. I've also managed to work round that.
None of the deficiencies of CW+, or of me as a programmer or application designer, stop the system being absolutely brilliant and usable to produce fully featured Windows applications - none of which need to use property sheets or for that matter, some of the other facilities.
Personally, I'd think that an application that crashes unexpectedly, thereby losing your work, isn't even barely usable, no matter how brilliant it looks up to that point. Now what was that epithet? Shot? Shut? Sheet?
Eddie |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2867 Location: South Pole, Antarctica
|
Posted: Mon Feb 01, 2021 12:15 am Post subject: |
|
|
Thank you all for trying.
Updated compiler and the %PS still crashes.
Eddie, the key words were "most probably". Of course you can recreate similar functionality and/or adopt it to fit specific device better and even make it look more modern, but even if it crashes in some cases (i have dozens working OK and one only can crash if i forgot to call it via workaround) the %PS is still so great that i can not live without it. Besides i found bearable workarounds till it will be fixed. I'd find more if it was really needed.
I'd even stress that almost no one with large codes can live without it and have manageable code. Recreation of similar functionality in house in such cases will not worth efforts. Also Microsoft and Paul slowly but steadily update look and feel of CWP. You also can do that so it will not look any boring or dated. As to crashing - Paul will fix it eventually. And will make new bugs possibly even in your workarounds |
|
Back to top |
|
|
|
|
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
|