Click here to Skip to main content
15,887,397 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Definitive Direct3D example Pin
Code-o-mat20-Nov-08 7:19
Code-o-mat20-Nov-08 7:19 
GeneralRe: Definitive Direct3D example Pin
Jim Crafton20-Nov-08 7:29
Jim Crafton20-Nov-08 7:29 
GeneralRe: Definitive Direct3D example Pin
Code-o-mat20-Nov-08 7:58
Code-o-mat20-Nov-08 7:58 
GeneralRe: Definitive Direct3D example Pin
cmk20-Nov-08 12:39
cmk20-Nov-08 12:39 
QuestionProbem with Directory Settings - Read Only Pin
Larry Mills Sr20-Nov-08 6:47
Larry Mills Sr20-Nov-08 6:47 
AnswerRe: Probem with Directory Settings - Read Only Pin
Venkata Rama Subbarao20-Nov-08 9:18
Venkata Rama Subbarao20-Nov-08 9:18 
QuestionC++ destructor problem Pin
Fred Andres20-Nov-08 4:44
Fred Andres20-Nov-08 4:44 
AnswerRe: C++ destructor problem Pin
Cedric Moonen20-Nov-08 4:57
Cedric Moonen20-Nov-08 4:57 
Please, read the posting guidelines before posting (use the 'pre' or 'code' tags to format your code).

For your question: the problem is that when you copy your variable (by doing this: vars[var0] = variable(completeTimes);), you create a copy of the first variable (which is a temporary one). The default behavior is that it will copy all the members as they are, so for pointers it will simply copy the address instead of allocating a new array. Thus, when the execution goes to the next line, your temporary variable (variable(completeTimes)) gets destroyed and will delete its arrays. And as your other variable (vars[var0]) only copied the address and not the content, these arrays are destroyed too.

In order to fix that, you have to provide a copy operator so that you can make a deep copy: you have to allocate new arrays instead of copying the address (don't forget to copy the other members too).

Cédric Moonen
Software developer

Charting control [v1.5]
OpenGL game tutorial in C++

GeneralRe: C++ destructor problem Pin
Fred Andres20-Nov-08 5:07
Fred Andres20-Nov-08 5:07 
QuestionRe: C++ destructor problem Pin
David Crow20-Nov-08 5:05
David Crow20-Nov-08 5:05 
AnswerRe: C++ destructor problem Pin
Fred Andres20-Nov-08 5:09
Fred Andres20-Nov-08 5:09 
AnswerRe: C++ destructor problem Pin
Roger Stoltz20-Nov-08 5:05
Roger Stoltz20-Nov-08 5:05 
QuestionAbout extracting image blocks Pin
berko300020-Nov-08 4:03
berko300020-Nov-08 4:03 
AnswerRe: Help my code Pin
Iain Clarke, Warrior Programmer20-Nov-08 4:10
Iain Clarke, Warrior Programmer20-Nov-08 4:10 
GeneralRe: Help my code Pin
Member 419459320-Nov-08 6:23
Member 419459320-Nov-08 6:23 
GeneralRe: Help my code Pin
Iain Clarke, Warrior Programmer20-Nov-08 10:31
Iain Clarke, Warrior Programmer20-Nov-08 10:31 
GeneralRe: Help my code Pin
Member 419459320-Nov-08 14:26
Member 419459320-Nov-08 14:26 
QuestionAPI call to find the port of a printer? [modified] Pin
sashoalm20-Nov-08 1:45
sashoalm20-Nov-08 1:45 
AnswerRe: API call to find the port of a printer? Pin
Randor 20-Nov-08 4:03
professional Randor 20-Nov-08 4:03 
GeneralRe: API call to find the port of a printer? Pin
sashoalm20-Nov-08 6:01
sashoalm20-Nov-08 6:01 
Questionhow to disable double click event on a button. Pin
Dhiraj kumar Saini20-Nov-08 1:00
Dhiraj kumar Saini20-Nov-08 1:00 
AnswerRe: how to disable double click event on a button. Pin
Code-o-mat20-Nov-08 1:30
Code-o-mat20-Nov-08 1:30 
GeneralRe: how to disable double click event on a button. Pin
Dhiraj kumar Saini20-Nov-08 1:50
Dhiraj kumar Saini20-Nov-08 1:50 
GeneralRe: how to disable double click event on a button. Pin
Code-o-mat20-Nov-08 2:00
Code-o-mat20-Nov-08 2:00 
GeneralRe: how to disable double click event on a button. Pin
Rajesh Katalkar23-Nov-08 7:58
Rajesh Katalkar23-Nov-08 7:58 

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.