Click here to Skip to main content
15,912,756 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: InternetExplorer - BeforeNavigate2 Pin
27-Sep-01 8:23
suss27-Sep-01 8:23 
QuestionPassing a CList (or reference to a CList) as a function parameter?? Pin
27-Sep-01 5:34
suss27-Sep-01 5:34 
AnswerRe: Passing a CList (or reference to a CList) as a function parameter?? Pin
Michael Dunn27-Sep-01 8:16
sitebuilderMichael Dunn27-Sep-01 8:16 
GeneralWebBrowser Control & 3D Borders Pin
27-Sep-01 4:43
suss27-Sep-01 4:43 
GeneralRef Counting Pin
User 988527-Sep-01 4:36
User 988527-Sep-01 4:36 
GeneralRe: Ref Counting Pin
Not Active27-Sep-01 6:55
mentorNot Active27-Sep-01 6:55 
GeneralRe: Ref Counting Pin
Joaquín M López Muñoz27-Sep-01 8:28
Joaquín M López Muñoz27-Sep-01 8:28 
GeneralRe: Ref Counting Pin
User 988527-Sep-01 8:52
User 988527-Sep-01 8:52 
Thankyou for the reply. I have already made the pointer that does the job of inc/dec, assignment etc.

I have a smart pointer implemented, that is used like this:
CPtr<CMyClass> p1 = new CMyClass;

This will make an object of type CMyClass inside the smart pointer and increment the ref count.

if I did
p1 = NULL;

the object would be deleted, because the reference count = 0;

Consider the following case :

I have a class with a member variable m_ptrList of type CPtrList or CTypedPtrList.
CClass::MyFunc()
{
 CPtr<CMyClass> p1 = new CMyClass;
 m_ptrList.AddHead(p1);
}

The problem that I foresee is that the AddHead will not increment the reference count. So will the object get deleted when MyFunc returns.

Is there something wrong in my understanding of the situation?


-Thomas

modified 29-Aug-18 21:01pm.

GeneralRe: Ref Counting Pin
Joaquín M López Muñoz27-Sep-01 9:28
Joaquín M López Muñoz27-Sep-01 9:28 
QuestionHow to change a item's parent of a tree control? Pin
27-Sep-01 3:52
suss27-Sep-01 3:52 
AnswerRe: How to change a item's parent of a tree control? Pin
Derek Lakin27-Sep-01 4:26
Derek Lakin27-Sep-01 4:26 
GeneralRe: How to change a item's parent of a tree control? Pin
27-Sep-01 15:54
suss27-Sep-01 15:54 
GeneralRe: How to change a item's parent of a tree control? Pin
Derek Lakin27-Sep-01 22:11
Derek Lakin27-Sep-01 22:11 
GeneralContol Bars Pin
27-Sep-01 3:43
suss27-Sep-01 3:43 
QuestionWhat the hell...? Pin
27-Sep-01 3:30
suss27-Sep-01 3:30 
AnswerRe: What the hell...? Pin
Rashid Thadha27-Sep-01 3:37
Rashid Thadha27-Sep-01 3:37 
GeneralThanks!!! Pin
27-Sep-01 3:46
suss27-Sep-01 3:46 
AnswerRe: What the hell...? Pin
Aaron Schaefer27-Sep-01 3:46
Aaron Schaefer27-Sep-01 3:46 
GeneralHot Keys Of Menu In A Dialog Box Pin
Ahmad9927-Sep-01 2:48
Ahmad9927-Sep-01 2:48 
GeneralRe: Hot Keys Of Menu In A Dialog Box Pin
Tomasz Sowinski27-Sep-01 2:54
Tomasz Sowinski27-Sep-01 2:54 
GeneralRe: Hot Keys Of Menu In A Dialog Box Pin
Ahmad9927-Sep-01 3:29
Ahmad9927-Sep-01 3:29 
GeneralRe: Hot Keys Of Menu In A Dialog Box Pin
Ahmad9927-Sep-01 3:29
Ahmad9927-Sep-01 3:29 
GeneralThanks Pin
Ahmad9927-Sep-01 4:27
Ahmad9927-Sep-01 4:27 
GeneralContent of Stl-Container in Debug-Mode Pin
Olivier Heidemann27-Sep-01 2:35
Olivier Heidemann27-Sep-01 2:35 
QuestionVideo Capture Resolution Change? Pin
jwrich0127-Sep-01 2:29
jwrich0127-Sep-01 2:29 

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.