Print Page | Close Window

CXTPSingletonPointer access violation

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=22874
Printed Date: 23 December 2024 at 2:37pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPSingletonPointer access violation
Posted By: markr
Subject: CXTPSingletonPointer access violation
Date Posted: 01 February 2016 at 4:02pm
I've received a couple of crash reports from users since upgrading to XTP v17, and today I was lucky enough to reproduce it in debug mode. It's very hard to trigger this crash (seems to be random), but here's the stack trace:

  ntdll.dll!RtlpWaitOnCriticalSection() Unknown
  ntdll.dll!RtlpEnterCriticalSectionContended() Unknown
> FolderSizes.exe!CXTPSingletonPointer::GetInstance() Line 68 C++
  FolderSizes.exe!CXTPSingleton<CXTPHookManager>::Instance() Line 119 C++
  FolderSizes.exe!XTPHookManager() Line 346 C++
  FolderSizes.exe!CXTPCommandBarsFrameHook::WinEventProc(CXTPWinEventHook::HWINEVENTHOOK__ * __formal, unsigned long event, HWND__ * hWnd, long idObject, long __formal, unsigned long __formal, unsigned long __formal) Line 114 C++
  user32.dll!__ClientCallWinEventProc() Unknown
  ntdll.dll!KiUserCallbackDispatcherContinue() Unknown
  user32.dll!NtUserPeekMessage() Unknown
  user32.dll!PeekMessageW() Unknown
  combase.dll!PeekTillDone(HWND__ * hWnd) Line 595 C++
  combase.dll!OXIDEntry::WaitForApartmentShutdown() Line 1525 C++
  combase.dll!OXIDEntry::StopServer() Line 1451 C++
  combase.dll!CComApartment::StopServer() Line 1424 C++
  combase.dll!StopThread(int fHostThread) Line 2404 C++
  combase.dll!ApartmentUninitialize(int fHostThread) Line 2621 C++
  combase.dll!wCoUninitialize(COleTls & Tls, int fHostThread) Line 4050 C++
  combase.dll!CoUninitialize() Line 3970 C++
  FolderSizes.exe!CXTPComInitializer::~CXTPComInitializer() Line 1288 C++
  FolderSizes.exe!CXTPComInitializer::`scalar deleting destructor'(unsigned int) C++
  FolderSizes.exe!CXTPMarkupObject::~CXTPMarkupObject() Line 627 C++
  FolderSizes.exe!CXTPMarkupType::~CXTPMarkupType() Line 390 C++
  FolderSizes.exe!CXTPMarkupType::`scalar deleting destructor'(unsigned int) C++
  FolderSizes.exe!CXTPMarkupObject::OnFinalRelease() Line 643 C++
  FolderSizes.exe!CCmdTarget::InternalRelease() Line 177 C++
  FolderSizes.exe!CXTPMarkupObject::Release() Line 649 C++
  FolderSizes.exe!CXTPMarkupType::CClassList::~CClassList() Line 294 C++
  FolderSizes.exe!`CXTPMarkupType::GetClassList'::`2'::`dynamic atexit destructor for 'list''() C++
  FolderSizes.exe!_execute_onexit_table::__l22::<lambda>() Line 198 C++
  FolderSizes.exe!__crt_seh_guarded_call<int>::operator()<void <lambda>(void),int <lambda>(void) & __ptr64,void <lambda>(void) >(__acrt_lock_and_call::__l3::void <lambda>(void) && setup, _execute_onexit_table::__l22::int <lambda>(void) & action, __acrt_lock_and_call::__l4::void <lambda>(void) && cleanup) Line 199 C++
  FolderSizes.exe!__acrt_lock_and_call<int <lambda>(void) >(const __acrt_lock_id lock_id, _execute_onexit_table::__l22::int <lambda>(void) && action) Line 882 C++
  FolderSizes.exe!_execute_onexit_table(_onexit_table_t * table) Line 222 C++
  FolderSizes.exe!common_exit(const int return_code, const _crt_exit_cleanup_mode cleanup_mode, const _crt_exit_return_mode return_mode) Line 211 C++
  FolderSizes.exe!exit(int return_code) Line 283 C++
  FolderSizes.exe!__scrt_common_main_seh() Line 275 C++
  FolderSizes.exe!__scrt_common_main() Line 309 C++
  FolderSizes.exe!wWinMainCRTStartup() Line 17 C++
  kernel32.dll!BaseThreadInitThunk() Unknown
  ntdll.dll!RtlUserThreadStart() Unknown

At the point of crash within CXTPSingletonPointer::GetInstance(), the m_access member CRITICAL_SECTION is NULL (assumedly because it's been deleted), which I believe is why the access violation occurs.

Never saw crashes anything like this with the XTP v16 code base, and would appreciate any feedback.

- Mark R.



Replies:
Posted By: markr
Date Posted: 01 February 2016 at 5:28pm
I found a way to reproduce this crash consistently, and doing so led me to a solution.

I have a CDialog window that is themed by deriving from CXTPCommandBarsFrameHook and calling EnableFrameTheme() from inside of OnInitDialog().

This dialog in turns uses CXTPTabControl to embed a series of other CDialog windows into tabs. One of those dialogs was ALSO deriving from CXTPCommandBarsFrameHook. Once that derivation was removed, this crash stopped occurring.

It appears that this nesting of CXTPCommandBarsFrameHook-derived windows was confusing the window hook.


Posted By: calvi
Date Posted: 09 February 2016 at 10:54am
I too have received a report caused by the same issue, which I can't reproduce.  This is the complete stack trace, which I submitted in a bug report:

ntdll.dll!RtlpWaitOnCriticalSection() Unknown
ntdll.dll!RtlpEnterCriticalSectionContended() Unknown
myapp.exe!CXTPSingletonPointer::GetInstance() Line 68 C++
myapp.exe!CXTPCommandBar::~CXTPCommandBar() Line 235 C++
[External Code]
myapp.exe!CCmdTarget::InternalRelease() Line 177 C++
[External Code]
combase.dll!CoUninitialize() Line 3769 C++
myapp.exe!CXTPMarkupObject::~CXTPMarkupObject() Line 627 C++
[External Code]
myapp.exe!CCmdTarget::InternalRelease() Line 177 C++
myapp.exe!CXTPMarkupType::CClassList::~CClassList() Line 288 C++
[External Code]

This indicates that the main application has terminated, and statically allocated objects are being destroyed.

The only explicit calls to the themes API are:

XTPPaintManager()->SetTheme(xtpThemeVisualStudio2010);
m_paneManager.SetTheme(xtpPaneThemeVisualStudio2010);
m_paneManager.SetThemedFloatingFrames(TRUE);

It may be significant that the customer's PC is unusually powerful:

Intel 8 Processor i7-4790K CPU @ 4.00GHz, with 16G Ram
2 Monitors with 1920 x 1200 Resolution



Posted By: cpede
Date Posted: 08 June 2016 at 10:09am
Any solution to this problem?

-cpede


-------------
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)


Posted By: calvi
Date Posted: 05 October 2016 at 5:54am
Is this bug going to be fixed in v17.3?



Posted By: guiuser1
Date Posted: 29 November 2016 at 6:44pm
I believe this issue will hit us also..

I have been trying to figure out a solution to themed CDialogs and I believe you have provided some interesting insight into this...

Our apps are also Tab View based and your concerns will probably also hit us.  We are testing v17.3 as we speak....trying to port our apps to CJ has been a task. Lot things work great but not everything. 

Unfortunately, the Tab views and themed dialogs is a big one for us as well.




Posted By: astoyan
Date Posted: 28 January 2017 at 12:43pm
Does anyone still have this issue after migration to 17.3? If so please provide details so that it's fixed for 18.0.

Regards,
  Alexander



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net