lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 8627572 4/4: Fix initializing a new HTML docu


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 8627572 4/4: Fix initializing a new HTML document containing the given cell
Date: Fri, 2 Nov 2018 07:42:53 -0400 (EDT)

branch: master
commit 8627572bbe65a0c4687cd04c95ece1e094f08f0e
Author: Vadim Zeitlin <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Fix initializing a new HTML document containing the given cell
    
    make_html_from() function didn't do anything useful as it made a shallow
    copy of the new document it created (leaking the original one in the
    process) instead of simply taking ownership of it.
    
    This meant that the object returned from this function did not contain
    the color and font cells which was the sole reason for its existence in
    the first place and, due to this, the header cells created using this
    function didn't use the correct initial font, resulting in visibly wrong
    appearance, which is fixed by this change.
---
 pdf_writer_wx.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/pdf_writer_wx.cpp b/pdf_writer_wx.cpp
index 9457570..615c384 100644
--- a/pdf_writer_wx.cpp
+++ b/pdf_writer_wx.cpp
@@ -388,9 +388,10 @@ pdf_writer_wx::make_html_from(wxHtmlCell* cell)
     initialize_html_parser(html_parser);
     html_parser.InitParser(wxString{});
 
-    auto document_cell = std::make_unique<wxHtmlContainerCell>
-        (static_cast<wxHtmlContainerCell*>(html_parser.GetProduct())
-        );
+    // Take ownership of the DOM containing just the initial colors and font.
+    std::unique_ptr<wxHtmlContainerCell> document_cell
+        {static_cast<wxHtmlContainerCell*>(html_parser.GetProduct())
+        };
 
     // Give ownership of the cell to the new document.
     document_cell->InsertCell(cell);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]