|
|
03-07-2016, 00:55
|
#1
|
Registered User
Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,119
|
OCPN 4.2.1 Master branch Win10 halts on exit
On Win10 VS2013 build.
Lasts commits to master branch makes O halting on closure. (Branch 4.4.0 works fine)
Some kind of method to reproduce:
Build last master branch and use package install.
- Start O and close. >> Normal closure
- Start O and feed it with Nav data, in my case from VDR, >> Halts on closure.
Attached log extracts has two parts. Good and bad closure. (Delete .pdf)
The last log entrance on bad closures are always:
Code:
09:29:21: opencpn::MyFrame exiting cleanly.
Håkan
|
|
|
11-07-2016, 12:06
|
#2
|
Registered User
Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,119
|
Re: OCPN 4.2.1 Master branch Win10 halts on exit
Since there was some updates to 4.2.1 I made a new test. Still the same result. Halts on exit after NAV data has been fed.
4.4.0 is still fine using the same conditions. (Like charts, ini file and VDR replay)
Håkan
|
|
|
17-07-2016, 08:09
|
#3
|
Registered User
Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,119
|
Re: OCPN 4.2.1 Master branch Win10 halts on exit
This issue is still valid.
To see if can be of any help I tried to debug and the pattern is the same. Without nav-data O closure is fine. With nav-data closure brakes:
opencpn.exe has triggered a breakpoint.
Debug Assertion Failed!
Program: C:\Builds\OCPN\OpenCPN\build\Debug\opencpn.exe
File: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\vector
Line: 1202
Expression: "Standard C++ Libraries Out of Range" && 0
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
Unhandled exception at 0x56A3A893 (msvcr120d.dll) in opencpn.exe: An invalid parameter was passed to a function that considers invalid parameters fatal.
My note: Debugger brake and was pointing here, Track.cpp row 648, at "return TrackP.........:
Code:
TrackPoint *Track::GetPoint( int nWhichPoint )
{
return TrackPoints[nWhichPoint];
}
My Note: nWhichPoint value was == 2 And TrackPoints size at the moment == 2
Is this helpful for a bug fix or can I do more?
Håkan
|
|
|
17-07-2016, 09:19
|
#4
|
Registered User
Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,119
|
Re: OCPN 4.2.1 Master branch Win10 halts on exit
Here I'm not aware of what I'm doing but with this nasty trick O close OK also when fed with nav-data:
Code:
TrackPoint *Track::GetPoint( int nWhichPoint )
{
if (2 == nWhichPoint) {
return TrackPoints[nWhichPoint - 1];
}
else {
return TrackPoints[nWhichPoint];
}
}
Håkan
|
|
|
17-07-2016, 09:26
|
#5
|
Marine Service Provider
Join Date: Mar 2008
Posts: 7,387
|
Re: OCPN 4.2.1 Master branch Win10 halts on exit
Hakan...
This is outstanding debugging. Led me right to the problem area, and the fix is clear.
In c and c++, indexes like vector[] start counting from 0. So, if the desired index is "2", and the vector only has two elements in it, then there will be an out-of-bounds error. With two elements, the last accessible element would be at vector[1].
Fixed now in github.
Thanks for the detailed and persistent work on this. Makes our jobs easier...
Dave
|
|
|
17-07-2016, 10:44
|
#6
|
Registered User
Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,119
|
Re: OCPN 4.2.1 Master branch Win10 halts on exit
Dave
Thanks, I'm happy to serve you.
But -- Now I get another brake in the same file at row 330
Code:
for( i = start_nPoint; i <= end_nPoint; i++ ) {
TrackPoint *psourcepoint = psourcetrack->GetPoint( i );
TrackPoint *ptargetpoint = new TrackPoint( psourcepoint->m_lat, psourcepoint->m_lon);
AddPoint( ptargetpoint );
}
I put a breakpoint at row 651: the new return NULL; and when this is true, E.G. returns NULL, on O closure the new debug brake occur.
If it's a real connection I don't know but:
The call stack says:
Code:
[00] wxDateTime::operator<= c:\wxwidgets-3.0.2\include\wx\datetime.h:853
[01] ActiveTrack::DoExtendDaily c:\builds\ocpn\opencpn\src\track.cpp:280
[02] MyFrame::TrackOff c:\builds\ocpn\opencpn\src\chart1.cpp:4516
[03] MyFrame::OnCloseWindow c:\builds\ocpn\opencpn\src\chart1.cpp:3278
[04] wxAppConsoleBase::HandleEvent c:\wxwidgets-3.0.2\src\common\appbase.cpp:612
[05] wxAppConsoleBase::CallEventHandler c:\wxwidgets-3.0.2\src\common\appbase.cpp:624
[06] wxEvtHandler::ProcessEventIfMatchesId c:\wxwidgets-3.0.2\src\common\event.cpp:1394
[07] wxEventHashTable::HandleEvent c:\wxwidgets-3.0.2\src\common\event.cpp:998
[08] wxEvtHandler::TryHereOnly c:\wxwidgets-3.0.2\src\common\event.cpp:1589
[09] wxEvtHandler::TryBeforeAndHere c:\wxwidgets-3.0.2\include\wx\event.h:3671
[10] wxEvtHandler::ProcessEvent c:\wxwidgets-3.0.2\src\common\event.cpp:1491
[11] wxEvtHandler::DoTryChain c:\wxwidgets-3.0.2\src\common\event.cpp:1554
[12] wxEvtHandler::ProcessEventLocally c:\wxwidgets-3.0.2\src\common\event.cpp:1522
[13] wxEvtHandler::ProcessEvent c:\wxwidgets-3.0.2\src\common\event.cpp:1495
[14] wxEvtHandler::SafelyProcessEvent c:\wxwidgets-3.0.2\src\common\event.cpp:1613
[15] wxWindowBase::HandleWindowEvent c:\wxwidgets-3.0.2\src\common\wincmn.cpp:1526
[16] wxWindowBase::Close c:\wxwidgets-3.0.2\src\common\wincmn.cpp:589
[17] wxFrame::MSWWindowProc c:\wxwidgets-3.0.2\src\msw\frame.cpp:848
[18] wxWndProc c:\wxwidgets-3.0.2\src\msw\window.cpp:2711
[19] SetManipulationInputTarget
[20] CallWindowProcW
C:\wxWidgets-3.0.2\include\wx/datetime.h(858): assert "IsValid() && dt.IsValid()" failed in wxDateTime::operator >(): invalid wxDateTime
C:\wxWidgets-3.0.2\include\wx/datetime.h(1733): assert "IsValid()" failed in wxDateTime::GetValue(): invalid wxDateTime
First-chance exception at 0x00D66053 in opencpn.exe: 0xC0000005: Access violation reading location 0x00000008.
Unhandled exception at 0x00D66053 in opencpn.exe: 0xC000041D: Det inträffade ett ohanterat undantag under motringningen.
The program '[9896] opencpn.exe' has exited with code 0 (0x0).
|
|
|
17-07-2016, 17:40
|
#7
|
Marine Service Provider
Join Date: Mar 2008
Posts: 7,387
|
Re: OCPN 4.2.1 Master branch Win10 halts on exit
Hakan...
The simple solution looks like this:
Code:
for( i = start_nPoint; i <= end_nPoint; i++ ) {
TrackPoint *psourcepoint = psourcetrack->GetPoint( i );
if(psourcepoint){
TrackPoint *ptargetpoint = new TrackPoint( psourcepoint->m_lat, psourcepoint->m_lon);
AddPoint( ptargetpoint );
}
}
I have committed this. There may be other cases where GetPoint() returns NULL, and will crash. We will find them one-by-one.
Sean, any comments?
Dave
|
|
|
17-07-2016, 23:33
|
#8
|
Registered User
Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,119
|
Re: OCPN 4.2.1 Master branch Win10 halts on exit
Dave
I've fetched your last commit but not yet Sean's big change.
In Debug on O closure and still only when nav-data is present I get a break first at:
datetime.h row 1733
Code:
inline wxLongLong wxDateTime::GetValue() const
{
>> wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime"));
return m_time;
}
And if I continue from there a new break at:
at row 858
Code:
inline bool operator>(const wxDateTime& dt) const
{
>> wxASSERT_MSG( IsValid() && dt.IsValid(), wxT("invalid wxDateTime") );
return GetValue() > dt.GetValue();
}
Note: I had a breakpoint at track.cpp and the NULL wasn't returned!
The first, row 1733, call stack attached as a pdf file
|
|
|
17-07-2016, 23:59
|
#9
|
Registered User
Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,119
|
Re: OCPN 4.2.1 Master branch Win10 halts on exit
I've now also tested commit "Merge branch 'texture_compression'................" in release mode.
So far it works on vector charts, CM93, but it's a disaster on raster. Starts with occasionally squared fragments of the charts then only a white surface.
Was this change tested in any Windows environment before merge?
But - it's closing without hangs also with nav data ????
Håkan
|
|
|
18-07-2016, 00:46
|
#10
|
Registered User
Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,119
|
Re: OCPN 4.2.1 Master branch Win10 halts on exit
Dave
Here I'm like a ping-pong ball between commits. Sorry - hope you can follow.
Now back on commit "Protect against NULL deref on Track::GetPoint()" consequently without commit "Merge branch 'texture_compression'.."
As earlier described I got a break in debug mode at "...wxDateTime ....". Now in release and running O as usual I can close O also when nav-dat is present without hangs. This is out of my understanding but you may have an explanation?
The Getpoint() NULL problem may be solved and the wxDateTime issues are something else???
Håkan
|
|
|
18-07-2016, 04:56
|
#11
|
Registered User
Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,532
|
Re: OCPN 4.2.1 Master branch Win10 halts on exit
Hakan, you've been promoted to the head of the class... bdbcat:"This is outstanding debugging...." Congratulations.
|
|
|
18-07-2016, 14:13
|
#12
|
Registered User
Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,119
|
Re: OCPN 4.2.1 Master branch Win10 halts on exit
This may be its own thread but since I've started here.....
More info about the not working raster charts after commit "Merge branch 'texture_compression'................"
> Raster charts are working when OpenGL is switched off.
> No difference with "Texture compression with Caching" off.
> If I, with OpenGL = on and Texture compression.... = on, clear texture cache the raster chart is momentarily shown but within a couple of seconds it's cleared out square by square. Probably while a cache is built up?
On the screen shots it can be seen how the chart is disappearing squares by squares (left) until the screen is white (right).
|
|
|
19-07-2016, 20:25
|
#13
|
Marine Service Provider
Join Date: Mar 2008
Posts: 7,387
|
Re: OCPN 4.2.1 Master branch Win10 halts on exit
Hakan...
Correct OpenGL texture compression in Windows platform. In github now.
Also updated Version number to 4.5.0, as unpublished Beta.
Thanks
Dave
|
|
|
20-07-2016, 00:28
|
#14
|
Registered User
Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,119
|
Re: OCPN 4.2.1 Master branch Win10 halts on exit
Dave
Tested in Win10:
Now this change is working for raster charts in Windows as well.
Many thanks.
Håkan
|
|
|
20-07-2016, 10:38
|
#15
|
Marine Service Provider
Join Date: Mar 2008
Posts: 7,387
|
Re: OCPN 4.2.1 Master branch Win10 halts on exit
Hakan....
I have corrected the wxAssert on invalid wxDateTime during shutdown, Win10 Debug mode. In github now.
Good Luck
Thanks
Dave
|
|
|
|
|
Thread Tools |
Search this Thread |
|
|
Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
Advertise Here
Recent Discussions |
|
|
|
|
|
|
|
|
|
|
|
|
Vendor Spotlight |
|
|
|
|