Assert on shutdown |
Post Reply |
Author | |
angelsoriasanagustin
Groupie Joined: 16 September 2015 Location: Spain Status: Offline Points: 46 |
Post Options
Thanks(0)
Posted: 06 June 2023 at 10:48am |
Hi.
Visual Studio 2022 ( 17.6.2 ) CodeJock Toolkit 22.1 Library linked as static. When program closes I have an Assert at: CXTPMarkupObject::~CXTPMarkupObject() SAFE_DELETE(m_pComInitializer); m_pComInitializer is NULL. I have read a similar post for older versions, but the suggested fix is already in this version. Same code with 22.0 version doesn't throw any exception. CXTPMarkupObject::~CXTPMarkupObject() is not called. Any solution ? Thanks.
|
|
angelsoriasanagustin
Groupie Joined: 16 September 2015 Location: Spain Status: Offline Points: 46 |
Post Options
Thanks(0)
|
Hi.
Any news ?
|
|
JonN
Newbie Joined: 11 January 2004 Location: United Kingdom Status: Offline Points: 8 |
Post Options
Thanks(0)
|
Hi,
I am experiencing a similar issue. I too get an assert during shutdown of a program. Ity appears to be generated from the destructor CXTPSingletonPointer::~CXTPSingletonPointer() which then calls through several functions including CXTPMarkupType::CClassList::~CClassList() where in this function the code iterates through the list below. The assert is called during the typeEntry.GetType() call when the key is "FrameworkContentElement" CXTPMarkupType::CClassList::~CClassList() { POSITION pos = m_namedTypes.GetStartPosition(); while (NULL != pos) { LPCWSTR key = NULL; CClassList::CTypeEntry typeEntry; m_namedTypes.GetNextAssoc(pos, key, typeEntry); CXTPMarkupType* pType = typeEntry.GetType(); MARKUP_RELEASE(pType); } pos = m_unnamedTypes.GetHeadPosition(); while (NULL != pos) { CXTPMarkupType* pType = m_unnamedTypes.GetNext(pos).GetType(); MARKUP_RELEASE(pType); } } GetType is listed as CXTPMarkupType* CXTPMarkupType::CClassList::CTypeEntry::GetType() const { if (NULL == m_pType) { ASSERT(NULL != m_pfnGetType); m_pType = m_pfnGetType(); } return m_pType; } The error would appear to be in the line m_pType = m_pfnGetType(); Tracking this through eventually leads to an EnterCriticalSection which fails with an access violation error. I had not noticed this with earlier versions which in version 19.3 seem to be identical to CXTPSingletonPointer::~CXTPSingletonPointer() and the two functions quoted above. A solution would be appreciated please. Jon
|
|
essess
Newbie Joined: 25 June 2023 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
We are experiencing the same issue after upgrading from Toolkit Pro 19.3.0 to 22.1.0.
In our case the crash happens when calling FreeLibrary on a DLL module on shutdown. However, the crash only happens if we call CXTPPaintManager::SetTheme(office2016) or similar style in the DLL module. If we don't style controls in the loaded DLL then there is no Access Violation on shutdown.
|
|
Radix
Newbie Joined: 02 July 2023 Status: Offline Points: 2 |
Post Options
Thanks(0)
|
Also experiencing the same - coming from ToolkitPro 20.3.0 which was fine, but now getting crashes when closing my application after the upgrade:
ntdll.dll!RtlpWaitOnCriticalSection() Unknown ntdll.dll!RtlpEnterCriticalSectionContended() Unknown ntdll.dll!RtlEnterCriticalSection() Unknown MOSESMotions.exe!CXTPMarkupFrameworkContentElement::GetCXTPMarkupFrameworkContentElementType(void) Unknown MOSESMotions.exe!CXTPMarkupType::CClassList::CTypeEntry::GetType(void) Unknown MOSESMotions.exe!CXTPMarkupType::CClassList::~CClassList(void) Unknown MOSESMotions.exe!CXTPSingletonPointer::Destroy(void) Unknown MOSESMotions.exe!CXTPSingletonPointer::~CXTPSingletonPointer(void) Unknown ucrtbase.dll!<lambda>(void)() Unknown ucrtbase.dll!__crt_seh_guarded_call<int>::operator()<<lambda_7777bce6b2f8c936911f934f8298dc43>,<lambda>(void) &,<lambda>(void)>() Unknown ucrtbase.dll!_execute_onexit_table() Unknown ucrtbase.dll!<lambda>(void)() Unknown ucrtbase.dll!__crt_seh_guarded_call<void>::operator()<<lambda_123965863b7b46a3332720573f9ce793>,<lambda>(void) &,<lambda>(void)>() Unknown ucrtbase.dll!common_exit() Unknown > MOSESMotions.exe!__scrt_common_main_seh() Line 295 C++ kernel32.dll!BaseThreadInitThunk() Unknown ntdll.dll!RtlUserThreadStart() Unknown Compile options I'm using: #define _XTP_INCLUDE_CONTROLS #define _XTP_INCLUDE_COMMANDBARS #define _XTP_INCLUDE_DOCKINGPANE #define _XTP_INCLUDE_RIBBON #define _XTP_INCLUDE_TABMANAGER #define _XTP_INCLUDE_PROPERTYGRID #define _XTP_EXCLUDE_MARKUP #define _XTP_EXCLUDE_SYNTAXEDIT #define _XTP_EXCLUDE_CALENDAR #define _XTP_EXCLUDE_CHART #define _XTP_EXCLUDE_FLOWGRAPH #define _XTP_EXCLUDE_GRAPHICLIBRARY #define _XTP_EXCLUDE_REPORTCONTROL #define _XTP_EXCLUDE_SHORTCUTBAR #define _XTP_EXCLUDE_SKINFRAMEWORK #define _XTP_EXCLUDE_TASKPANEL #define _XTP_EXCLUDE_GRIDCONTROL #define _XTP_STATICLINK |
|
astoyan
Admin Group Joined: 24 August 2013 Status: Offline Points: 306 |
Post Options
Thanks(0)
|
Thanks everyone for reporting those issues and providing valuable details. It is a known complex problem related to Markup. Unfortunately, due to the nature of the issue it's not reproducible in Codejock samples and it is very specific to various use cases, that's why it takes so long to address it. However we already know most of the causes and are working on the major fix for Markup and related API. We appreciate anyone submitting a sample project that would help us to verify and potentially fix it for that specific use case. You can submit a test project either here or send to support with a reference to the forum thread, even if you have no active maintenance.
Thank you in advance.
|
|
essess
Newbie Joined: 25 June 2023 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
I stumpled upon another issue that you might want to consider in your fixes.
I don't know if you are ever meant to call XTPShutdown() yourself, but if you explicitly call XTPShutdown() in an application that has a CXTPStatusBar then an assert is thrown in CXTPSingletonPointer::GetInstance() on shutdown.
You can reproduce this issue with the Samples\CommandBars\DialogSample project by adding a call to XTPShutdown(), for instance at the end of method CDialogSampleApp::InitInstance(), just before the line return FALSE;. Method CDialogSampleApp::InitInstance() can be found in the file: "C:\Program Files (x86)\Codejock Software\MFC\Xtreme ToolkitPro v22.1.0\Samples\CommandBars\DialogSample\DialogSample.cpp", Resulting call stack: > DialogSample.exe!CXTPSingletonPointer::GetInstance() Line 67 C++ DialogSample.exe!CXTPSingleton<CXTPPaintManager::CGlobalPaintManagerPtr,CXTPSingletonDependencies<CXTPSingleton<CXTPGdiPlus,CXTPSingletonDependencies<CXTPDummySingletonDependency,CXTPDummySingletonDependency,CXTPDummySingletonDependency,CXTPDummySingletonDependency,CXTPDummySingletonDependency,CXTPDummySingletonDependency,CXTPDummySingletonDependency,CXTPDummySingletonDependency,CXTPDummySingletonDependency,CXTPDummySingletonDependency>>,CXTPDummySingletonDependency,CXTPDummySingletonDependency,CXTPDummySingletonDependency,CXTPDummySingletonDependency,CXTPDummySingletonDependency,CXTPDummySingletonDependency,CXTPDummySingletonDependency,CXTPDummySingletonDependency,CXTPDummySingletonDependency>>::Instance() Line 221 C++ DialogSample.exe!CXTPPaintManager::ReleaseInstance() Line 296 C++ DialogSample.exe!CXTPStatusBar::~CXTPStatusBar() Line 141 C++ [External Code] DialogSample.exe!CDialogSampleApp::InitInstance() Line 96 C++ [External Code] DialogSample.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow) Line 26 C++ System Information: Toolkit Pro 22.1.0 Visual Studio 2019 Dynamic Debug - x64 Windows 11 Pro Version 10.0.22621 Build 22621 |
|
astoyan
Admin Group Joined: 24 August 2013 Status: Offline Points: 306 |
Post Options
Thanks(0)
|
If the main application class is derived from CXTPWinApp then XTPShutdown must not be called.
It is highly recommended to derive CXTPWinApp class because it encapsulates proper ToolkitPro initialization and termination logic. Older ToolkitPro versions didn't use much of it, but future versions will have more important initialization logic added to it, including proper Markup and COM/OLE initialization sequence that is being discussed in this topic.
|
|
Radix
Newbie Joined: 02 July 2023 Status: Offline Points: 2 |
Post Options
Thanks(0)
|
I'm guessing the Markup code doesn't properly check for #define _XTP_EXCLUDE_MARKUP then |
|
timop
Newbie Joined: 10 March 2021 Status: Offline Points: 1 |
Post Options
Thanks(0)
|
I have also assert when XTP_DECLARE_MARKUP_STRING_CONSTANT is used.
Ctor of CXTPMarkupString specifies "CXTPMarkupObject::flagNoCom", but dtor requires COM. When COM is initialized, then there is no assert. It is already fixed in version 22.1
|
|
jmarcosf
Groupie Joined: 22 June 2006 Status: Offline Points: 27 |
Post Options
Thanks(0)
|
Hi all,
I am using v22.1 and experienced same problem. Just in case it helps this is my ExitInstance() method which solved my problem. int CModule::ExitInstance()
{ CoUninitialize(); return CXTPWinApp::ExitInstance(); } |
|
matsjansson
Groupie Joined: 09 May 2023 Location: Solna Status: Offline Points: 17 |
Post Options
Thanks(0)
|
I had a similar issue, with a crash in EnterCriticalSection connected to some Markup.
The problem was solved by deriving my App class from CXTPWinApp instead of CWinApp. BUT HOW SHOULD I KNOW THAT I NEED TO DERIVE FROM THAT CLASS???? Is there any documentation at all to read? |
|
astoyan
Admin Group Joined: 24 August 2013 Status: Offline Points: 306 |
Post Options
Thanks(0)
|
The initially reported issue and a large number of related issue have been already fixed for the next ToolkitPro update. However it is still possible that some rare use cases remained unaccounted for.
This has been reflected in the release notes when CXTPWinApp was added. It is also used in all our samples. We always ask our users to refer to our samples for usage examples as most of the use cases are demonstrated there. Regards, Alexander
|
|
matsjansson
Groupie Joined: 09 May 2023 Location: Solna Status: Offline Points: 17 |
Post Options
Thanks(0)
|
Ok,
I am new to this tool. I have taken over a project that uses version 10.3.1 and now we have bought v22.1.0. I have not read all the relase notes from 10.3.1 to now, but maybe I should. /Mats |
|
astoyan
Admin Group Joined: 24 August 2013 Status: Offline Points: 306 |
Post Options
Thanks(0)
|
The new beta version of ToolkitPro 24.0 has been released, it is expected to fix all those and related issues in Markup. The beta release should be available for download for your account if you have an active subscription, if you don't have one please consider upgrading. Please report any new issues found.
Regards, Alexander
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |