[prev in list] [next in list] [prev in thread] [next in thread]
List: kdevelop
Subject: bug in kdevelop1.4's Qt2 MDI project template
From: Rüdiger Knörig <ruediger () knoerig ! de>
Date: 2001-07-02 20:56:39
[Download RAW message or body]
While working on a kdevelop Qt2 mdi project I got crashes if the loading of a
document failed and a new document should be created. The code in the
"openDocumentFile" member function of the doc object who should do this is:
doc = new QtpLgviewerDoc();
pDocList->append(doc);
doc->newDocument();
// Creates an untitled window if file is 0
if(!file)
{
untitledCount+=1;
QString fileName=QString(tr("Untitled%1")).arg(untitledCount);
doc->setPathName(fileName);
doc->setTitle(fileName);
}
// Open the file
else
{
try{doc->openDocument(file);}
catch(QString errormsg)
{
QMessageBox::critical(this, tr("Error !"),tr(errormsg));
delete doc;
return;
}
}
// create the window
createClient(doc);
This causes trouble if the document could not be loaded (exception catch), so
you have a destroyed object in pDocList!
To fix this, use the remove() method of pFocList:
else
{
try{doc->openDocument(file);}
catch(QString errormsg)
{
QMessageBox::critical(this, tr("Error !"),tr(errormsg));
pDocList->remove(doc);
return;
}
}
The constructor of the app object sets AutoDelete to true, so the object ist
deleted.
-
to unsubscribe from this list send an email to kdevelop-request@kdevelop.org with the following body:
unsubscribe »your-email-address«
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic