View Issue Details

IDProjectCategoryView StatusLast Update
0002121Ham Radio DeluxeBugpublic2018-07-25 20:47
ReporterK7ZCZ 
Assigned ToK7ZCZ 
PrioritynormalSeveritycrashReproducibilitysometimes
Status closedResolutionfixed 
PlatformIntel i7-5960XOSWindows 10 Professional x64OS Version1703
Product Version6.4.0.658 
Target VersionFixed in Version6.4.0.873 
Summary0002121: Logbook crashes with multiple Awards windows open
DescriptionI'm able to make a crash in Logbook with multiple aWadrs windows open. The repro case is a bit iffy because I can't always make the crash, but it looks to me that there's a double-free of a Award2Definition object; or concurrent manipulation of the m_astrAddCommands object within the object.

The call stack is pretty reliable, and it is attached.

This issue is a bit frustrating to work, since the logbook is slow with a large database and even slower when an Awards dialog is open.
Steps To Reproduce1) 4 databases; Connected to SQL Server with one, loaded with the 63000 record database I often use.
2) Awards window open
3) Close the logbook app
4) Open the logbook app
5) Activate the logbook tab (not the awards tab, or any other open tab)
6) Click the "Awards management" button in the toolbar. This creates another logbook window
7) The new Awards window is now open, and is active
8) Activate the other ("first") awards window that persisted from your previous run
BUG#1) Crash at the attached call stack.
TagsNo tags attached.
ModuleLogbook
Sub-ModuleAwards
Testing Beta Successful

Relationships

Activities

K7ZCZ

2017-07-09 12:38

manager  

AwardsCrashStack.txt (3,988 bytes)

 	HRDLogbook.exe!ATL::CSimpleStringT<wchar_t,0>::CloneData(ATL::CStringData * pData=0x00300022) Line 882	C++
 	HRDLogbook.exe!ATL::CSimpleStringT<wchar_t,0>::CSimpleStringT<wchar_t,0>(const ATL::CSimpleStringT<wchar_t,0> & strSrc={...}) Line 213	C++
 	HRDLogbook.exe!ATL::CStringT<wchar_t,StrTraitMFC<wchar_t,ATL::ChTraitsCRT<wchar_t> > >::CStringT<wchar_t,StrTraitMFC<wchar_t,ATL::ChTraitsCRT<wchar_t> > >(const ATL::CStringT<wchar_t,StrTraitMFC<wchar_t,ATL::ChTraitsCRT<wchar_t> > > & strSrc={...}) Line 989	C++
>	HRDLogbook.exe!CAwards2View::DrawRow(CDC * pDC=0x00cfd2b4, CRect & rectItem={...}, unsigned int uiState=0, unsigned int idx=0, CAwards2Object * pAO=0x4ac499c8, unsigned int * puiWidths=0x00cfd260, int iFocus=-1) Line 1145	C++
 	HRDLogbook.exe!CAwards2View::OnDrawReportItem(tagDRAWITEMSTRUCT * lpDrawItemStruct=0x00cfd84c) Line 910	C++
 	HRDLogbook.exe!CAwards2View::OnDrawItem(int nIDCtl=1000, tagDRAWITEMSTRUCT * lpDrawItemStruct=0x00cfd84c) Line 867	C++
 	HRDLogbook.exe!CWnd::OnWndMsg(unsigned int message=43, unsigned int wParam=1000, long lParam=13621324, long * pResult=0x00cfd500) Line 2561	C++
 	HRDLogbook.exe!CWnd::WindowProc(unsigned int message=43, unsigned int wParam=1000, long lParam=13621324) Line 2094	C++
 	HRDLogbook.exe!AfxCallWndProc(CWnd * pWnd=0x0e5083c8, HWND__ * hWnd=0x00210d0e, unsigned int nMsg=43, unsigned int wParam=1000, long lParam=13621324) Line 282	C++
 	HRDLogbook.exe!AfxWndProc(HWND__ * hWnd=0x00210d0e, unsigned int nMsg=43, unsigned int wParam=1000, long lParam=13621324) Line 435	C++
 	[External Code]	
 	HRDLogbook.exe!CWnd::DefWindowProcW(unsigned int nMsg=15, unsigned int wParam=0, long lParam=0) Line 1110	C++
 	HRDLogbook.exe!CWnd::WindowProc(unsigned int message=15, unsigned int wParam=0, long lParam=0) Line 2095	C++
 	HRDLogbook.exe!AfxCallWndProc(CWnd * pWnd=0x0e508444, HWND__ * hWnd=0x005d0d3a, unsigned int nMsg=15, unsigned int wParam=0, long lParam=0) Line 282	C++
 	HRDLogbook.exe!AfxWndProc(HWND__ * hWnd=0x005d0d3a, unsigned int nMsg=15, unsigned int wParam=0, long lParam=0) Line 435	C++
 	[External Code]	
 	HRDLogbook.exe!CWnd::OnWndMsg(unsigned int message=546, unsigned int wParam=2038120, long lParam=0, long * pResult=0x00cfea64) Line 2425	C++
 	HRDLogbook.exe!CWnd::WindowProc(unsigned int message=546, unsigned int wParam=2038120, long lParam=0) Line 2094	C++
 	[External Code]	
 	HRDLogbook.exe!AfxCallWndProc(CWnd * pWnd=0x0e68e2e4, HWND__ * hWnd=0x003f1930, unsigned int nMsg=546, unsigned int wParam=2038120, long lParam=0) Line 282	C++
 	HRDLogbook.exe!AfxWndProc(HWND__ * hWnd=0x003f1930, unsigned int nMsg=546, unsigned int wParam=2038120, long lParam=0) Line 435	C++
 	[External Code]	
 	HRDLogbook.exe!CWnd::SendMessageW(unsigned int message=546, unsigned int wParam=2038120, long lParam=0) Line 32	C++
 	[External Code]	
 	HRDLogbook.exe!CWnd::OnWndMsg(unsigned int message=513, unsigned int wParam=1, long lParam=852306, long * pResult=0x00cff75c) Line 2596	C++
 	[External Code]	
 	HRDLogbook.exe!CWnd::WindowProc(unsigned int message=513, unsigned int wParam=1, long lParam=852306) Line 2094	C++
 	HRDLogbook.exe!AfxCallWndProc(CWnd * pWnd=0x0e55f8c8, HWND__ * hWnd=0x003d17d8, unsigned int nMsg=513, unsigned int wParam=1, long lParam=852306) Line 282	C++
 	HRDLogbook.exe!AfxWndProc(HWND__ * hWnd=0x003d17d8, unsigned int nMsg=513, unsigned int wParam=1, long lParam=852306) Line 435	C++
 	[External Code]	
 	HRDLogbook.exe!AfxInternalPumpMessage() Line 181	C++
 	HRDLogbook.exe!CWinThread::PumpMessage() Line 900	C++
 	HRDLogbook.exe!CWinThread::Run() Line 629	C++
 	HRDLogbook.exe!CWinApp::Run() Line 787	C++
 	HRDLogbook.exe!AfxWinMain(HINSTANCE__ * hInstance=0x01110000, HINSTANCE__ * hPrevInstance=0x00000000, wchar_t * lpCmdLine=0x00e83298, int nCmdShow=10) Line 47	C++
 	HRDLogbook.exe!wWinMain(HINSTANCE__ * hInstance=0x01110000, HINSTANCE__ * hPrevInstance=0x00000000, wchar_t * lpCmdLine=0x00e83298, int nCmdShow=10) Line 26	C++




AwardsCrashStack.txt (3,988 bytes)

K7ZCZ

2017-07-09 14:13

manager   ~0003604

The Logbook application object maintains a list of awards definitions

When an Awards frame is created, it reloads the app's collection of award definitions. The function that does this is called LoadDefaults(), though I'm not sure what context "Defaults" might have for the user here.

The loading code unconditonally reads the definitions from an XML file. If a read definition has the same name as a definition in memory, the definition in memory is removed and the new definition is added to the list.

When the second Awards Definition view creates, it queries the app for the awards definitions and uses them to compute the awards and draw the window. That works fine.

But when focus is switched to the first, original awards window, the missing award definitions are de-referenced. Since they've been deleted, a crash results.

At first blush, I think the clear solution is to not delete items from the collection when reloading. Or, to not relaod at all. The code in the Awards2Frame has a test to see if the awards list has already been populated, but that test was commented out:


    //if (App().Awards2().Count() == 0)
        App().Awards2().LoadDefaults();


Looks like that was done in October of 2015 with this change set: https://hrdsoftware.visualstudio.com/HRD/_versionControl/changeset/1201?path=%24%2FHRD%2FHRD%20control%2FLogbook%2FHRDLogbook%2FAwards2Frame.cpp&gridItemType=2&mpath=%24%2FHRD%2FHRD%20control%2FLogbook%2FHRDLogbook%2FAwards2Frame.cpp&opath=%24%2FHRD%2FHRD%20control%2FLogbook%2FHRDLogbook%2FAwards2Frame.cpp&mversion=1201&oversion=P1201&_a=compare

An alternate solution might be to disallow multiple awards windows, but that still probably requires fixing this code.

In particular, there's a Load() method on the Awards2 collection which loads awards from a file. This is run at application startup. LoadDefaults() loads awards from an XML string resource baked into the application. Despite there being two sources of awards, LoadDefaults() matches names and excludes definitions that were set up by provided by Load(). As such, any two windows might or might not be using different definitions of awards.

K7ZCZ

2017-07-09 14:14

manager   ~0003605

The AwardsCrashCauseStack shows the location where an award definition is deleted and a new one created in its stead; it is as this point where the object the first view window is referencing is destroyed. Further up this stack is the call to LoadDefaults() from the Awards2Frame window, which is the main culprit.

AwardsCrashCauseStack.txt (5,828 bytes)
>	HRDLogbook.exe!CAward2Definitions::Add(const CAward2Definition & award={...}) Line 582	C++
 	HRDLogbook.exe!CAward2Definitions::Load(CXMLMgr & xml={...}, bool bLock=true) Line 780	C++
 	HRDLogbook.exe!CAward2Definitions::LoadDefaults() Line 907	C++
 	HRDLogbook.exe!CAwards2Frame::OnCreate(tagCREATESTRUCTW * lpCreateStruct=0x00cfd408) Line 467	C++
 	HRDLogbook.exe!CWnd::OnWndMsg(unsigned int message=1, unsigned int wParam=0, long lParam=13620232, long * pResult=0x00cfd134) Line 2392	C++
 	HRDLogbook.exe!CXTPCommandBarsSiteBase<CMDIChildWnd>::OnWndMsg(unsigned int message=1, unsigned int wParam=0, long lParam=13620232, long * pResult=0x00cfd134) Line 191	C++
 	HRDLogbook.exe!CWnd::WindowProc(unsigned int message=1, unsigned int wParam=0, long lParam=13620232) Line 2094	C++
 	HRDLogbook.exe!AfxCallWndProc(CWnd * pWnd=0x0ba45820, HWND__ * hWnd=0x00161232, unsigned int nMsg=1, unsigned int wParam=0, long lParam=13620232) Line 282	C++
 	HRDLogbook.exe!AfxWndProc(HWND__ * hWnd=0x00161232, unsigned int nMsg=1, unsigned int wParam=0, long lParam=13620232) Line 435	C++
 	[External Code]	
 	HRDLogbook.exe!CWnd::DefWindowProcW(unsigned int nMsg=544, unsigned int wParam=0, long lParam=13624348) Line 1110	C++
 	HRDLogbook.exe!CWnd::Default() Line 315	C++
 	[External Code]	
 	HRDLogbook.exe!CWnd::OnWndMsg(unsigned int message=544, unsigned int wParam=0, long lParam=13624348, long * pResult=0x00cfdfcc) Line 2425	C++
 	HRDLogbook.exe!CWnd::WindowProc(unsigned int message=544, unsigned int wParam=0, long lParam=13624348) Line 2094	C++
 	[External Code]	
 	HRDLogbook.exe!AfxCallWndProc(CWnd * pWnd=0x0de632e4, HWND__ * hWnd=0x00431978, unsigned int nMsg=544, unsigned int wParam=0, long lParam=13624348) Line 282	C++
 	HRDLogbook.exe!AfxWndProc(HWND__ * hWnd=0x00431978, unsigned int nMsg=544, unsigned int wParam=0, long lParam=13624348) Line 435	C++
 	[External Code]	
 	HRDLogbook.exe!CMDIChildWnd::Create(const wchar_t * lpszClassName=0x0a2dfd60, const wchar_t * lpszWindowName=0x037bf5e4, unsigned long dwStyle=1087340544, const tagRECT & rect={...}, CMDIFrameWnd * pParentWnd=0x0de63040, CCreateContext * pContext=0x00cfe558) Line 537	C++
 	HRDLogbook.exe!CMDIChildWnd::LoadFrame(unsigned int nIDResource=20060, unsigned long dwDefaultStyle=1087340544, CWnd * pParentWnd=0x00000000, CCreateContext * pContext=0x00cfe558) Line 607	C++
 	HRDLogbook.exe!CXTPFrameWndBase<CMDIChildWnd>::LoadFrame(unsigned int nIDResource=20060, unsigned long dwDefaultStyle=13598720, CWnd * pParentWnd=0x00000000, CCreateContext * pContext=0x00cfe558) Line 230	C++
 	HRDLogbook.exe!CDocTemplate::CreateNewFrame(CDocument * pDoc=0x3cca48d8, CFrameWnd * pOther=0x0de63040) Line 294	C++
 	HRDLogbook.exe!CHRDLogbookApp::AwardsTracking(const CLogbookDatabase & database={...}) Line 1750	C++
 	HRDLogbook.exe!CHRDLogbookView::OnLogbookAwardTracking() Line 3986	C++
 	HRDLogbook.exe!_AfxDispatchCmdMsg(CCmdTarget * pTarget=0x0bf4cb98, unsigned int nID=33223, int nCode=0, void (void) * pfn=0x019d2680, void * pExtra=0x00000000, unsigned int nSig=58, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000) Line 77	C++
 	HRDLogbook.exe!CCmdTarget::OnCmdMsg(unsigned int nID=33223, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000) Line 373	C++
 	HRDLogbook.exe!CView::OnCmdMsg(unsigned int nID=33223, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000) Line 164	C++
 	HRDLogbook.exe!CFrameWnd::OnCmdMsg(unsigned int nID=33223, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000) Line 980	C++
 	HRDLogbook.exe!CWnd::OnCommand(unsigned int wParam=33223, long lParam=0) Line 2784	C++
 	HRDLogbook.exe!CFrameWnd::OnCommand(unsigned int wParam=33223, long lParam=0) Line 384	C++
 	HRDLogbook.exe!CWnd::OnWndMsg(unsigned int message=273, unsigned int wParam=33223, long lParam=0, long * pResult=0x00cfe9f4) Line 2108	C++
 	HRDLogbook.exe!CXTPCommandBarsSiteBase<CMDIChildWnd>::OnWndMsg(unsigned int message=273, unsigned int wParam=33223, long lParam=0, long * pResult=0x00cfe9f4) Line 191	C++
 	HRDLogbook.exe!CWnd::WindowProc(unsigned int message=273, unsigned int wParam=33223, long lParam=0) Line 2094	C++
 	HRDLogbook.exe!AfxCallWndProc(CWnd * pWnd=0x0bf58c70, HWND__ * hWnd=0x00511902, unsigned int nMsg=273, unsigned int wParam=33223, long lParam=0) Line 282	C++
 	HRDLogbook.exe!AfxWndProc(HWND__ * hWnd=0x00511902, unsigned int nMsg=273, unsigned int wParam=33223, long lParam=0) Line 435	C++
 	[External Code]	
 	HRDLogbook.exe!CWnd::SendMessageW(unsigned int message=273, unsigned int wParam=33223, long lParam=0) Line 32	C++
 	[External Code]	
 	HRDLogbook.exe!CWnd::OnWndMsg(unsigned int message=513, unsigned int wParam=1, long lParam=1245822, long * pResult=0x00cff9a0) Line 2596	C++
 	[External Code]	
 	HRDLogbook.exe!CWnd::WindowProc(unsigned int message=513, unsigned int wParam=1, long lParam=1245822) Line 2094	C++
 	HRDLogbook.exe!AfxCallWndProc(CWnd * pWnd=0x0c024e98, HWND__ * hWnd=0x00141790, unsigned int nMsg=513, unsigned int wParam=1, long lParam=1245822) Line 282	C++
 	HRDLogbook.exe!AfxWndProc(HWND__ * hWnd=0x00141790, unsigned int nMsg=513, unsigned int wParam=1, long lParam=1245822) Line 435	C++
 	[External Code]	
 	HRDLogbook.exe!AfxInternalPumpMessage() Line 181	C++
 	HRDLogbook.exe!CWinThread::PumpMessage() Line 900	C++
 	HRDLogbook.exe!CWinThread::Run() Line 629	C++
 	HRDLogbook.exe!CWinApp::Run() Line 787	C++
 	HRDLogbook.exe!AfxWinMain(HINSTANCE__ * hInstance=0x01110000, HINSTANCE__ * hPrevInstance=0x00000000, wchar_t * lpCmdLine=0x000f3298, int nCmdShow=10) Line 47	C++
 	HRDLogbook.exe!wWinMain(HINSTANCE__ * hInstance=0x01110000, HINSTANCE__ * hPrevInstance=0x00000000, wchar_t * lpCmdLine=0x000f3298, int nCmdShow=10) Line 26	C++
 	[External Code]	

K7ZCZ

2017-07-09 14:19

manager   ~0003606

Last edited: 2017-07-09 14:19

View 2 revisions

The awards definition file that tries to load is here (on my machine):

C:\Users\mikeblas.PROZAC\AppData\Roaming\HRDLLC\HRD Logbook\LogbookAward2Defns.xml

On my dev machine, this file doesn't exist because I've not done a retail product install. The application ignores this failure at startup, and eventually loads the default files.

The configuration of my dev machine might influence the reproducability of the problem, but it's certainly an issue that the list is re-loaded each time a new window is created -- any other window has the opportunity to have pointers remaining to deleted objects.

K7ZCZ

2017-09-07 18:08

manager   ~0004133

IIRC, we talked about this in chat. There was some question about whether or not we should allow multiple awards windows in the first place or not. It seemed to me that we should because different databases would have different totals. My assumption was that there would be multiple views open, one for each open database. But that view is confounded by the way that databases are configured to participate in (or not participate in) award tracking.

To fix this correctly needs at least a little bit of design work ... Is the right fix to allow only one view instance, application-wide?

WA9PIE

2018-04-25 23:42

administrator   ~0004891

I really think we should consider not allowing multiple awards windows open at a time. There are a number of reasons. Primarily - it will be confusing for the user (having multiple logs open and not clear about which awards window goes with which log). Frankly, if they change logs, the existing open awards window should probably close to eliminate the confusion.

All up for discussion, however. I could be convinced that - if we somehow named the awards windows to match the database, it could make sense.

WA9PIE

2018-06-27 14:26

administrator   ~0005508

Let's limit Logbook to only 1 awards tab at a time. Otherwise, there's no way for the user to know which database it's referring to.

That is... the awards are looking to the databases that are "opted-in" in Databases Manager.

K7ZCZ

2018-07-08 14:56

manager   ~0005638

fixed with this checkin to the MikeB2 branch
https://hrdsoftware.visualstudio.com/HRD/_versionControl/changeset/4216

K7ZCZ

2018-07-12 14:33

manager   ~0005661

merged to the main branch with this checkin:
https://hrdsoftware.visualstudio.com/HRD/_versionControl/changeset/4223

g3ucq

2018-07-13 15:31

viewer   ~0005678

This seems fixed although I have not experienced the crash referenced.

WA9PIE

2018-07-17 16:46

administrator   ~0005724

I completed the steps and did not get the crash.

Issue History

Date Modified Username Field Change
2017-07-09 12:28 K7ZCZ New Issue
2017-07-09 12:38 K7ZCZ File Added: AwardsCrashStack.txt
2017-07-09 14:13 K7ZCZ Note Added: 0003604
2017-07-09 14:14 K7ZCZ File Added: AwardsCrashCauseStack.txt
2017-07-09 14:14 K7ZCZ Note Added: 0003605
2017-07-09 14:19 K7ZCZ Note Added: 0003606
2017-07-09 14:19 K7ZCZ Note Edited: 0003606 View Revisions
2017-09-07 18:08 K7ZCZ Assigned To => WA9PIE
2017-09-07 18:08 K7ZCZ Status new => feedback
2017-09-07 18:08 K7ZCZ Note Added: 0004133
2017-09-18 00:14 WA9PIE Project 3 - Current Dev List => 2 - Next Dev List (Holding Area)
2018-04-13 10:23 WA9PIE Project 2 - Next Dev List (Holding Area) => 3 - Current Dev List
2018-04-25 23:42 WA9PIE Note Added: 0004891
2018-06-27 14:26 WA9PIE Note Added: 0005508
2018-06-27 14:26 WA9PIE Assigned To WA9PIE => K7ZCZ
2018-07-08 14:56 K7ZCZ Note Added: 0005638
2018-07-12 14:33 K7ZCZ Status feedback => resolved
2018-07-12 14:33 K7ZCZ Resolution open => fixed
2018-07-12 14:33 K7ZCZ Fixed in Version => 6.4.0.864
2018-07-12 14:33 K7ZCZ Testing => Not Started
2018-07-12 14:33 K7ZCZ Note Added: 0005661
2018-07-13 15:31 g3ucq Note Added: 0005678
2018-07-17 16:46 WA9PIE Status resolved => closed
2018-07-17 16:46 WA9PIE Description Updated View Revisions
2018-07-17 16:46 WA9PIE Testing Not Started => Beta Successful
2018-07-17 16:46 WA9PIE Note Added: 0005724
2018-07-23 22:52 WA9PIE Project 3 - Current Dev List => Ham Radio Deluxe
2018-07-24 15:36 WA9PIE Project Ham Radio Deluxe => 3 - Current Dev List
2018-07-25 08:00 WA9PIE Fixed in Version 6.4.0.864 => 6.4.0.873
2018-07-25 20:47 WA9PIE Project 3 - Current Dev List => Ham Radio Deluxe