Click here to Skip to main content
15,888,461 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: If CDialog is destroyed is UI CWinThread created While object was alive get destroyed as Well Pin
ForNow8-Jun-12 10:52
ForNow8-Jun-12 10:52 
GeneralRe: If CDialog is destroyed is UI CWinThread created While object was alive get destroyed as Well Pin
«_Superman_»8-Jun-12 16:11
professional«_Superman_»8-Jun-12 16:11 
AnswerRe: If CDialog is destroyed is UI CWinThread created While object was alive get destroyed as Well Pin
Albert Holguin8-Jun-12 4:33
professionalAlbert Holguin8-Jun-12 4:33 
QuestionCorruption of the heap. Why ? Pin
sdancer757-Jun-12 23:49
sdancer757-Jun-12 23:49 
AnswerRe: Corruption of the heap. Why ? Pin
Rolf Kristensen8-Jun-12 2:01
Rolf Kristensen8-Jun-12 2:01 
GeneralRe: Corruption of the heap. Why ? Pin
Erudite_Eric8-Jun-12 2:35
Erudite_Eric8-Jun-12 2:35 
GeneralRe: Corruption of the heap. Why ? Pin
sdancer758-Jun-12 6:02
sdancer758-Jun-12 6:02 
AnswerRe: Corruption of the heap. Why ? Pin
Aescleal8-Jun-12 3:00
Aescleal8-Jun-12 3:00 
You're calling two completely different functions! In the first example you're calling CCatalogView::Create, in the second you're calling CFrameWnd::Create.

As to why it's failing.. I can't tell exactly but one idea is that you're creating the CCatalogView as an automatic object. When you call CreatePane a WIN32 window object is created. When the pane window (as in the WIN32 window) is destroyed it tells the CCatalogView to do a delete this;. As the C++ object is on the stack delete goes a bit haywire.

In the second case everything's allocated on the heap. You CCatalogView is implicitly created on the heap by CFrameWnd::Create. When the WIN32 window objects are destroyed the delete this; works the way it should do and everything's cool.

Just out of interest all this delete this; rubbish generally happens in whatever override of CWnd::PostNCDestroy gets called. As a general rule always create MFC C++ window objects on the heap, unless it's a modal dialogue when it's safe to create it on the stack.
GeneralRe: Corruption of the heap. Why ? Pin
sdancer758-Jun-12 6:03
sdancer758-Jun-12 6:03 
GeneralRe: Corruption of the heap. Why ? Pin
sdancer759-Jun-12 3:43
sdancer759-Jun-12 3:43 
GeneralRe: Corruption of the heap. Why ? Pin
Aescleal9-Jun-12 9:51
Aescleal9-Jun-12 9:51 
GeneralRe: Corruption of the heap. Why ? Pin
sdancer759-Jun-12 23:58
sdancer759-Jun-12 23:58 
GeneralRe: Corruption of the heap. Why ? Pin
sdancer7512-Jun-12 3:18
sdancer7512-Jun-12 3:18 
QuestionException when debugging Multithread Pin
ForNow7-Jun-12 19:04
ForNow7-Jun-12 19:04 
AnswerRe: Exception when debugging Multithread Pin
«_Superman_»7-Jun-12 19:15
professional«_Superman_»7-Jun-12 19:15 
GeneralRe: Exception when debugging Multithread Pin
ForNow7-Jun-12 23:53
ForNow7-Jun-12 23:53 
GeneralRe: Exception when debugging Multithread Pin
ForNow7-Jun-12 23:58
ForNow7-Jun-12 23:58 
AnswerRe: Exception when debugging Multithread Pin
Erudite_Eric7-Jun-12 20:34
Erudite_Eric7-Jun-12 20:34 
AnswerRe: Exception when debugging Multithread Pin
Richard MacCutchan7-Jun-12 21:53
mveRichard MacCutchan7-Jun-12 21:53 
GeneralRe: Exception when debugging Multithread Pin
Erudite_Eric7-Jun-12 23:35
Erudite_Eric7-Jun-12 23:35 
GeneralRe: Exception when debugging Multithread Pin
Richard MacCutchan8-Jun-12 0:19
mveRichard MacCutchan8-Jun-12 0:19 
QuestionCalculate checksum using ASLR Pin
Giggsey737-Jun-12 8:39
Giggsey737-Jun-12 8:39 
QuestionRe: Calculate checksum using ASLR Pin
David Crow7-Jun-12 8:43
David Crow7-Jun-12 8:43 
AnswerRe: Calculate checksum using ASLR Pin
Giggsey737-Jun-12 8:46
Giggsey737-Jun-12 8:46 
AnswerRe: Calculate checksum using ASLR Pin
David Crow7-Jun-12 8:55
David Crow7-Jun-12 8:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.