null settings reveal improper ownership bugs which are now fixed, no more luck needed, fixed a missing delete in destructor

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4267 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
shatty 2003-08-10 10:33:36 +00:00
parent 54b7d67454
commit d727a85b3b

View File

@ -51,11 +51,8 @@ StyledEditWindow::StyledEditWindow(BRect frame, entry_ref *ref, uint32 encoding)
StyledEditWindow::~StyledEditWindow() StyledEditWindow::~StyledEditWindow()
{ {
if (fSaveMessage) delete fSaveMessage;
delete fSaveMessage; delete fPrintSettings;
// if (fPrintSettings)
// delete fPrintSettings;
delete fSavePanel; delete fSavePanel;
} /***~StyledEditWindow()***/ } /***~StyledEditWindow()***/
@ -1118,13 +1115,13 @@ StyledEditWindow::PageSetup(const char *documentname)
BPrintJob printJob(documentname); BPrintJob printJob(documentname);
if (fPrintSettings != NULL) { if (fPrintSettings != NULL) {
printJob.SetSettings(fPrintSettings); printJob.SetSettings(new BMessage(*fPrintSettings));
fPrintSettings = NULL;
} }
result = printJob.ConfigPage(); result = printJob.ConfigPage();
if (result == B_NO_ERROR) { if (result == B_NO_ERROR) {
delete fPrintSettings;
fPrintSettings = printJob.Settings(); fPrintSettings = printJob.Settings();
} }
@ -1144,14 +1141,12 @@ StyledEditWindow::Print(const char *documentname)
} }
BPrintJob printJob(documentname); BPrintJob printJob(documentname);
printJob.SetSettings(fPrintSettings); printJob.SetSettings(new BMessage(*fPrintSettings));
fPrintSettings = NULL;
result = printJob.ConfigJob(); result = printJob.ConfigJob();
if (result != B_OK) { if (result != B_OK) {
return; return;
} }
// information from printJob // information from printJob
fPrintSettings = printJob.Settings();
BRect paper_rect = printJob.PaperRect(); BRect paper_rect = printJob.PaperRect();
BRect printable_rect = printJob.PrintableRect(); BRect printable_rect = printJob.PrintableRect();
int32 firstPage = printJob.FirstPage(); int32 firstPage = printJob.FirstPage();