[M-git] Mahogany sources repository. branch master updated. v0.67-813-g566f4ab8

Vadim Zeitlin via Mahogany-cvsupdates <[email protected]> Mon, 04 Jan 2021 23:16:04 +0000
Newsgroups gmane.mail.mahogany.cvs
Message-ID <[email protected]>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Mahogany sources repository.".

The branch, master has been updated
       via  566f4ab86549de6a7ed6e625e0821f6e3c5e88a2 (commit)
       via  b0490673f557cbbd7c777f74fb84c3e05f529486 (commit)
      from  a89d73c33234732c0ddba4c4644ff981e6c95fef (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 566f4ab86549de6a7ed6e625e0821f6e3c5e88a2
Author: Vadim Zeitlin <[email protected]>
Date:   Tue Jan 5 00:14:56 2021 +0100

    Fix warning about inconsistent operators redefinition in iterator
    
    Tell the compiler to generate both copy ctor and assignment operator
    instead of defining the former one but leaving the latter one to be
    default-generated.

diff --git a/include/lists.h b/include/lists.h
index 72acbf3d..d85c9232 100644
--- a/include/lists.h
+++ b/include/lists.h
@@ -123,7 +123,8 @@ public: \
        @param n if not NULL, the node to which to point \
    */ \
    inline iterator(ListNode *n = NULL) : node(n) {} \
-   inline iterator(const iterator &i) : node(i.node) {} \
+   iterator(const iterator &i) = default; \
+   iterator& operator=(const iterator &i) = default; \
    /** Dereference operator. \
        @return the data pointer of the node belonging to this \
        iterator \

commit b0490673f557cbbd7c777f74fb84c3e05f529486
Author: Vadim Zeitlin <[email protected]>
Date:   Tue Jan 5 00:13:25 2021 +0100

    Make wxHTML VFS file names not only simpler, but correct
    
    This fixes a bug introduced in 5214239b0 (Make wxHTML VFS file names
    simpler and more unique, 2020-12-07) which never reused a VFS name,
    meaning that the same attachment used different names when it was added
    and when trying to remove it later, triggering an assert and a memory
    leak as the attachment was never actually removed.

diff --git a/src/modules/HtmlViewer.cpp b/src/modules/HtmlViewer.cpp
index f06a619a..1e683bfa 100644
--- a/src/modules/HtmlViewer.cpp
+++ b/src/modules/HtmlViewer.cpp
@@ -193,9 +193,16 @@ private:
    bool m_hasHtmlContents;
 
 
+   // This is used in GetVirtualFileName() to ensure that the names we return
+   // from there are distinct for different objects by incrementing this
+   // counter every time a new viewer object is created.
+   static unsigned long s_viewerCount;
+
    DECLARE_MESSAGE_VIEWER()
 };
 
+unsigned long HtmlViewer::s_viewerCount = 0;
+
 // ----------------------------------------------------------------------------
 // HTML_Handler_META: wxHTML handler for the <meta> tag, see EncodingChanger
 // ----------------------------------------------------------------------------
@@ -580,6 +587,8 @@ IMPLEMENT_MESSAGE_VIEWER(HtmlViewer,
 
 HtmlViewer::HtmlViewer()
 {
+   s_viewerCount++;
+
    wxFileSystem::AddHandler(new wxInternetFSHandler);
 
    m_window = NULL;
@@ -870,10 +879,7 @@ int HtmlViewer::CalculateFontSize(const wxFont& font)
 
 wxString HtmlViewer::GetVirtualFileName(size_t n) const
 {
-   // the image file names must be globally unique, so use a counter to ensure
-   // we never reuse it
-   static unsigned long s_htmlImage = 0;
-   return wxString::Format(_T("Mhtml%08lx%zd.png"), ++s_htmlImage, n);
+   return wxString::Format(_T("Mhtml%08lx%zd.png"), s_viewerCount, n);
 }
 
 wxString HtmlViewer::CreateImageInMemoryFS(const wxImage& image)

-----------------------------------------------------------------------

Summary of changes:
 include/lists.h            |  3 ++-
 src/modules/HtmlViewer.cpp | 14 ++++++++++----
 2 files changed, 12 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
Mahogany sources repository.