![]() |
CXTDirWatcher Crash |
Post Reply
|
| Author | |
AliRafiee
Groupie
Joined: 06 May 2004 Status: Offline Points: 32 |
Post Options
Thanks(0)
Quote Reply
Topic: CXTDirWatcher CrashPosted: 21 February 2006 at 11:51am |
|
Hi, I have a CXTShellListCtrl in a dialog box. When I close the dialog box and then navigate using the Windows Explorer to the directory that the CXTShellListCtrl was displaying and delete a file, or add a file my program will crash. It crashes in CXTDirWatcher, there is a WaitForMultipleObject(...,INIFINT) in the InitInstance, since the dialog box is closed thread object is actually deleted, but it is still running, when the event hits, the thread crashes. If I remember correctly I sent you guys a fix for this a year or so ago? Do you guys have a fix for this? If I remember correctly the fix is to change the thread into a worker thread instead of a gui thread.
// XTDirWatcher.cpp : implementation file #include "stdafx.h" #include <io.h> #ifdef _DEBUG UINT DirWatcherThread(void *pParam); CXTDirWatcher::CXTDirWatcher() CXTDirWatcher::~CXTDirWatcher() void CXTDirWatcher::StartMonitoring() void CXTDirWatcher::SuspendThread() void CXTDirWatcher::ResumeThread() BOOL CXTDirWatcher::IsPathValid(LPCTSTR lpszFolderPath) if (_taccess(lpszFolderPath, 0) == -1) return TRUE; BOOL CXTDirWatcher::SetFolderPath(CWnd* pMainWnd, LPCTSTR lpszFolderPath) return TRUE; return FALSE; BOOL CXTDirWatcher::SetFolderData(CWnd* pMainWnd, XT_TVITEMDATA* lpTVID) TCHAR szFolderPath[_MAX_PATH]; return FALSE; BOOL CXTDirWatcher::GetFolderData(LPCTSTR lpszFolderPath, XT_TVITEMDATA& lpTVID) if (!IsPathValid(lpszFolderPath)) #if !defined( _UNICODE ) // Convert the path to an ITEMIDLIST. lpTVID.lpsfParent = psfMyFolder; return TRUE; return FALSE; void CXTDirWatcher::RefreshFolder() void CXTDirWatcher::RefreshTree()
HANDLE m_dwChangeHandles[2]; // Change event handles. m_dwChangeHandles[0] = INVALID_HANDLE_VALUE; if (pWatcher->IsPathValid(pWatcher->GetFolderPath())) while (!pWatcher->MustExit()) switch (m_dwWaitStatus) if (!::FindNextChangeNotification(m_dwChangeHandles[0])) break; if (!FindNextChangeNotification(m_dwChangeHandles[1])) break; Ali Rafiee |
|
![]() |
|
RedDragon
Newbie
Joined: 01 June 2006 Status: Offline Points: 2 |
Post Options
Thanks(0)
Quote Reply
Posted: 14 November 2006 at 11:40am |
|
No answer to this question yet?
I have a problem with object as well... the CXTShellListCtrlEx object sends notifications in RefreshFolder() even though the window is destroyed, and the DirWatcher is protected so there is no way to stop this behavior... Well, the solution I'm using now is to override this object which gives me access to the StopNotifications function. But I'd rather like this to be within CodeJock, if possible? |
|
![]() |
|
AliRafiee
Groupie
Joined: 06 May 2004 Status: Offline Points: 32 |
Post Options
Thanks(0)
Quote Reply
Posted: 14 November 2006 at 11:50am |
|
I believe they fixed this problem in 9.7. What they did to fix the problem is that they added another event to the event list that the thread listens for, this event is a quit event. And then they set this event in the destructor of the controls that use this threads, so that the thread actually ends when the control is destroyed.
Ali
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 14 November 2006 at 1:37pm |
|
Yes, it was fixed in some old version.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
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 |