Click here to Skip to main content
15,914,165 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MSDev.exe crashing at startup Pin
James Spibey7-Nov-02 0:20
James Spibey7-Nov-02 0:20 
GeneralRe: MSDev.exe crashing at startup Pin
Chris Meech7-Nov-02 2:43
Chris Meech7-Nov-02 2:43 
QuestionCan anyone see the problem in this code? Pin
Anonymous6-Nov-02 13:33
Anonymous6-Nov-02 13:33 
AnswerRe: Can anyone see the problem in this code? Pin
moliate6-Nov-02 14:29
moliate6-Nov-02 14:29 
GeneralRe: Can anyone see the problem in this code? Pin
Anonymous7-Nov-02 6:48
Anonymous7-Nov-02 6:48 
GeneralRe: Can anyone see the problem in this code? Pin
moliate7-Nov-02 12:15
moliate7-Nov-02 12:15 
GeneralApplication hiding and inactive at startup Pin
Anonymous6-Nov-02 13:10
Anonymous6-Nov-02 13:10 
GeneralDeleting objects created with the new operator Pin
Daniel Jurnove6-Nov-02 12:59
sussDaniel Jurnove6-Nov-02 12:59 
I'm having a problem deleting objects I've created with the new operator. I have two classes: Particle and ParticleExplosion. ParticleExplosion has:
vector< Particle * > pL

Inside the constructor to the ParticleExplosion class, I make a whole bunch of Particles and put pointers to them in a vector ( pL ):

ParticleExplosion::ParticleExplosion()
{
for( i = 0; i < this->numParticles; ++i )
{
p = new Particle;
pL.push_back( p ); // pL is a vector
}
}

When a ParticleExplosion object gets destroyed (by going out of scope), it's not taking the objects the pL points to with it (which I expected). So, I made my own destructor for ParticleExplosion, where I step through the vector, and delete each item that it poitns to:


ParticleExplosion::~ParticleExplosion()
{
for( int i = pL.size(); i > 0; --i)
{
delete this->pL[i]
}
}

After deleting the first item, the program crashes. Am I going about this the right way?

daniel@jurnove.net
GeneralRe: Deleting objects created with the new operator Pin
Christian Graus6-Nov-02 13:15
protectorChristian Graus6-Nov-02 13:15 
GeneralRe: Deleting objects created with the new operator Pin
Maximilien6-Nov-02 13:17
Maximilien6-Nov-02 13:17 
GeneralVisual studio installer, shortcut question Pin
Anonymous6-Nov-02 12:58
Anonymous6-Nov-02 12:58 
Generalpoppin controls in win32 api Pin
stephen.hazel6-Nov-02 12:42
stephen.hazel6-Nov-02 12:42 
GeneralProfiling with Visual C++net Pin
el666-Nov-02 12:30
el666-Nov-02 12:30 
GeneralRe: Profiling with Visual C++net Pin
Nick Hodapp6-Nov-02 12:42
sitebuilderNick Hodapp6-Nov-02 12:42 
GeneralRe: Profiling with Visual C++net Pin
el667-Nov-02 4:05
el667-Nov-02 4:05 
GeneralCString and console app. Pin
Nick Parker6-Nov-02 11:49
protectorNick Parker6-Nov-02 11:49 
GeneralRe: CString and console app. Pin
Boogie6-Nov-02 12:08
Boogie6-Nov-02 12:08 
GeneralRe: CString and console app. Pin
Nick Parker6-Nov-02 12:14
protectorNick Parker6-Nov-02 12:14 
GeneralRe: CString and console app. Pin
Boogie6-Nov-02 12:17
Boogie6-Nov-02 12:17 
GeneralRe: CString and console app. Pin
Nick Parker6-Nov-02 12:32
protectorNick Parker6-Nov-02 12:32 
GeneralRe: CString and console app. Pin
James Spibey7-Nov-02 0:27
James Spibey7-Nov-02 0:27 
GeneralRe: CString and console app. Pin
Nick Parker7-Nov-02 1:02
protectorNick Parker7-Nov-02 1:02 
Generalskip droping the combobox Pin
jimNLX6-Nov-02 11:38
jimNLX6-Nov-02 11:38 
GeneralRe: skip droping the combobox Pin
alex.barylski6-Nov-02 11:56
alex.barylski6-Nov-02 11:56 
GeneralRe: skip droping the combobox Pin
Anonymous7-Nov-02 3:06
Anonymous7-Nov-02 3:06 

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.