Click here to Skip to main content
16,016,580 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to add a macro to active document in MFC Pin
22-May-02 11:50
suss22-May-02 11:50 
QuestionHow to add automation methods and properties in VC++7.0 Pin
Tim Ranker22-May-02 11:46
Tim Ranker22-May-02 11:46 
AnswerRe: How to add automation methods and properties in VC++7.0 Pin
Tim Ranker22-May-02 12:48
Tim Ranker22-May-02 12:48 
Generalstd::string weird behaviour??¿?¿ Pin
Carlos Sánchez García22-May-02 10:27
Carlos Sánchez García22-May-02 10:27 
GeneralRe: std::string weird behaviour??¿?¿ Pin
Joaquín M López Muñoz22-May-02 10:43
Joaquín M López Muñoz22-May-02 10:43 
GeneralRe: std::string weird behaviour??¿?¿ Pin
Dean Goodman22-May-02 10:57
Dean Goodman22-May-02 10:57 
GeneralRe: std::string weird behaviour??¿?¿ Pin
Carlos Sánchez García22-May-02 23:12
Carlos Sánchez García22-May-02 23:12 
GeneralTwo questions: CFileDialog & vector Pin
Dean Goodman22-May-02 9:59
Dean Goodman22-May-02 9:59 
CFileDialog dlg(TRUE, NULL, lastPath, OFN_ALLOWMULTISELECT,
_T("Text file (.txt)|*.txt|")
_T("All files (*.*) |*.*|")
);

...
if (dlg.DoModal() != IDOK)
DoSomething();
...

The above code works fine in the debug version, but curiosly enough, the dialog box hangs in the release version when a file is selected and the 'Open' button is pressed. Any ideas?

------------------------

Secondly, I have a set up like the following:

CClass1 {
...
vector<cclass2> data;
...
}

CClass2 {
//member funcs
private:
std::string str;
int x;
... (member variables)
}

CClass1* obj;
...
delete obj; //crash here

In my code I have a pointer to a CClass1 object (which I know is valid) that I am trying to deallocate. The program crashes when I call delete.

After much time spent, I know the problem arises when the last object in the data vector is deleted. I've tried using the default destructor to take care of deallocating the vector, I've tried calling data.resize(0);, data.clear();, and while (data.size()) data.pop_back(); -- all with the same result. Deleting the last object in the vector causes an assertion in dbgheap.c Expression:_CrtIsValidHeapPointer(pUserData)

More specifically, the assertion always occurs when the str member of CClass2 is being deallocated. Note that this is not a pointer to a string being deleted - it is a string object. Thus there should not be an issue with deleting the same string twice.

I thought maybe I had done something stupid and corrupted the heap along the way, but I've been looking over my code for a long time now and I'm fairly certain there are no double deletes, dangling pointers, etc. I know the above might not be very clear, but any insight would be appreciated.

Thanks,

DG
GeneralRe: Two questions: CFileDialog & vector Pin
Chris Losinger22-May-02 10:01
professionalChris Losinger22-May-02 10:01 
GeneralRe: Two questions: CFileDialog & vector Pin
Dean Goodman22-May-02 10:32
Dean Goodman22-May-02 10:32 
GeneralRe: Two questions: CFileDialog & vector Pin
Joaquín M López Muñoz22-May-02 11:08
Joaquín M López Muñoz22-May-02 11:08 
GeneralExtended MAPI vs. Outlook Object Model Pin
22-May-02 9:22
suss22-May-02 9:22 
GeneralInserting strings Pin
Emearg22-May-02 8:58
Emearg22-May-02 8:58 
GeneralRe: Inserting strings Pin
Carlos Antollini22-May-02 9:25
Carlos Antollini22-May-02 9:25 
GeneralRe: Inserting strings Pin
Dean Goodman22-May-02 10:02
Dean Goodman22-May-02 10:02 
GeneralRe: Inserting strings Pin
Emearg23-May-02 5:41
Emearg23-May-02 5:41 
GeneralSearching for files in a specific folder and it's subfolders. Pin
redeemer22-May-02 8:58
redeemer22-May-02 8:58 
GeneralRe: Searching for files in a specific folder and it's subfolders. Pin
Chris Losinger22-May-02 9:07
professionalChris Losinger22-May-02 9:07 
GeneralRe: Searching for files in a specific folder and it's subfolders. Pin
redeemer22-May-02 9:09
redeemer22-May-02 9:09 
GeneralRe: Searching for files in a specific folder and it's subfolders. Pin
Chris Losinger22-May-02 9:12
professionalChris Losinger22-May-02 9:12 
GeneralRe: Searching for files in a specific folder and it's subfolders. Pin
Mazdak22-May-02 9:21
Mazdak22-May-02 9:21 
GeneralRe: Searching for files in a specific folder and it's subfolders. Pin
Martin Ziacek22-May-02 9:24
Martin Ziacek22-May-02 9:24 
GeneralWould it work if i did this: Pin
redeemer22-May-02 9:54
redeemer22-May-02 9:54 
GeneralAVIFile & audio Pin
Zizilamoroso22-May-02 8:33
Zizilamoroso22-May-02 8:33 
GeneralSettling Listview subitem color Pin
22-May-02 7:51
suss22-May-02 7:51 

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.