From d727a85b3b3210aca4b9304c60ed8c6a46f21efc Mon Sep 17 00:00:00 2001 From: shatty Date: Sun, 10 Aug 2003 10:33:36 +0000 Subject: [PATCH] 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 --- src/apps/stylededit/StyledEditWindow.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/apps/stylededit/StyledEditWindow.cpp b/src/apps/stylededit/StyledEditWindow.cpp index 895f362e81..36acf3fba8 100644 --- a/src/apps/stylededit/StyledEditWindow.cpp +++ b/src/apps/stylededit/StyledEditWindow.cpp @@ -51,11 +51,8 @@ StyledEditWindow::StyledEditWindow(BRect frame, entry_ref *ref, uint32 encoding) StyledEditWindow::~StyledEditWindow() { - if (fSaveMessage) - delete fSaveMessage; -// if (fPrintSettings) -// delete fPrintSettings; - + delete fSaveMessage; + delete fPrintSettings; delete fSavePanel; } /***~StyledEditWindow()***/ @@ -1118,13 +1115,13 @@ StyledEditWindow::PageSetup(const char *documentname) BPrintJob printJob(documentname); if (fPrintSettings != NULL) { - printJob.SetSettings(fPrintSettings); - fPrintSettings = NULL; + printJob.SetSettings(new BMessage(*fPrintSettings)); } result = printJob.ConfigPage(); if (result == B_NO_ERROR) { + delete fPrintSettings; fPrintSettings = printJob.Settings(); } @@ -1144,14 +1141,12 @@ StyledEditWindow::Print(const char *documentname) } BPrintJob printJob(documentname); - printJob.SetSettings(fPrintSettings); - fPrintSettings = NULL; + printJob.SetSettings(new BMessage(*fPrintSettings)); result = printJob.ConfigJob(); if (result != B_OK) { return; } // information from printJob - fPrintSettings = printJob.Settings(); BRect paper_rect = printJob.PaperRect(); BRect printable_rect = printJob.PrintableRect(); int32 firstPage = printJob.FirstPage();