File dialog problem


09-11-2012 21:31:51

Hello, i am trying to get this to work but many problems with memory seems occouring. I am using exact copy of dialog.h and dialog.cpp from that thread, then in my main menu delegate i am using this :
if(_item->getCaption() == "Open")
mDialog = new FileSelectionDialog("Open");
mDialog->setDialogTitle("Open file");
//Add youd own callback function:
boost::function<void(FileSelectionDialog*, const std::string&)> my_callback = boost::bind(&Editor::loadObj, this, _1, _2);
//Your callback must be something like that:
//void myFileSelectedCallBack(FileSelectionDialog* dialog, const std::string& path){...Do what you want...};
//How to pop it up:
//After all don't foget delete it:
delete mDialog;

dialog opens fine but when i am trying to open some file it is getting crash at this location
void FileSelectionDialog::endDialogCallback(MyGUI::Widget* _sender)
// last minute fix --forgot to account for the user entering the filename himself
// Note that since the Dialog has no idea if the user should be creating a new file, it doesn't check if the
// file exists or not. That's your job.

std::string filename = mFileEdit->getCaption();

// make sure it has an extension
if (mExtensionCombo->getIndexSelected() != 0) <<<<<<<<<<<<HERE
std::string extension = mExtensionCombo->getCaption();
if (filename.length() > extension.length())...

even when i am trying to close that dialog it crashes here:
void FileSelectionDialog::windowCloseCallback(MyGUI::Window* _sender, const std::string& _name)
mWindow->setVisible(false); <<<<<<<<<<HERE

all crashes seems like this

0xC0000005: Access violation reading location 0x3c000000.

Thanks for possible help

11-11-2012 09:42:50

mWindow == 0
show me layout