Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTPSingletonPointer access violation
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPSingletonPointer access violation

 Post Reply Post Reply
Author
Message
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 443
Post Options Post Options   Thanks (1) Thanks(1)   Quote markr Quote  Post ReplyReply Direct Link To This Post Topic: CXTPSingletonPointer access violation
    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.
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 443
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
calvi View Drop Down
Groupie
Groupie


Joined: 20 March 2004
Location: United Kingdom
Status: Offline
Points: 43
Post Options Post Options   Thanks (0) Thanks(0)   Quote calvi Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 668
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post 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++)
Back to Top
calvi View Drop Down
Groupie
Groupie


Joined: 20 March 2004
Location: United Kingdom
Status: Offline
Points: 43
Post Options Post Options   Thanks (0) Thanks(0)   Quote calvi Quote  Post ReplyReply Direct Link To This Post Posted: 05 October 2016 at 5:54am
Is this bug going to be fixed in v17.3?

Back to Top
guiuser1 View Drop Down
Groupie
Groupie
Avatar

Joined: 17 November 2015
Status: Offline
Points: 34
Post Options Post Options   Thanks (0) Thanks(0)   Quote guiuser1 Quote  Post ReplyReply Direct Link To This Post 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.


Back to Top
astoyan View Drop Down
Admin Group
Admin Group
Avatar

Joined: 24 August 2013
Status: Offline
Points: 304
Post Options Post Options   Thanks (0) Thanks(0)   Quote astoyan Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.