Bonjour,
Mon application utilise les DLL MFC liées statiquement.
En debug, cela fonctionne bien. En release cela plante...
Au moment de l'Initinstance j'ai :
Lors du passage dans la fonction ProcessShellCommand() il créé un nouveau fichier au moyen de la fonction : CDocManager::OnFileNew();
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); if (!ProcessShellCommand(cmdInfo)) return FALSE;
Après plusieurs opérations, il tombe dans la fonction suivante :
Et il provoque in assert sur le AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56 ///////////////////////////////////////////////////////////////////////////// // CSingleDocTemplate commands CDocument* CSingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, BOOL bMakeVisible) // if lpszPathName == NULL => create new file of this type { CDocument* pDocument = NULL; CFrameWnd* pFrame = NULL; BOOL bCreated = FALSE; // => doc and frame created BOOL bWasModified = FALSE; if (m_pOnlyDoc != NULL) { // already have a document - reinit it pDocument = m_pOnlyDoc; if (!pDocument->SaveModified()) return NULL; // leave the original one pFrame = (CFrameWnd*)AfxGetMainWnd(); ASSERT(pFrame != NULL); ASSERT_KINDOF(CFrameWnd, pFrame); ASSERT_VALID(pFrame); } else { // create a new document pDocument = CreateNewDocument(); ASSERT(pFrame == NULL); // will be created below bCreated = TRUE; } if (pDocument == NULL) { AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC); return NULL; } ASSERT(pDocument == m_pOnlyDoc); if (pFrame == NULL) { ASSERT(bCreated); // create frame - set as main document frame BOOL bAutoDelete = pDocument->m_bAutoDelete; pDocument->m_bAutoDelete = FALSE; // don't destroy if something goes wrong pFrame = CreateNewFrame(pDocument, NULL); pDocument->m_bAutoDelete = bAutoDelete; if (pFrame == NULL) { AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC); delete pDocument; // explicit delete on error return NULL; } }
En liant les MFC dynamiquement cela fonctionne bien...
Si quelqu'un aurait une idée de la raison du plantage...
Partager