[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - include/jvmfwk

Stephan Bergmann sbergman at redhat.com
Wed Jul 13 20:01:11 UTC 2016


 include/jvmfwk/framework.hxx |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

New commits:
commit ea7618f53efcd61d5911c276cc54587a9757b9e5
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 10 21:40:45 2016 +0100

    Fix memory leaks
    
    (cherry picked from commit eee4dd746ea3fc09d51d008446ec82e3de456eed)
    
    Change-Id: If9f7dc4a28d5e005959f0d4a0a2ed317b699f292

diff --git a/include/jvmfwk/framework.hxx b/include/jvmfwk/framework.hxx
index a68bf7f..e306109 100644
--- a/include/jvmfwk/framework.hxx
+++ b/include/jvmfwk/framework.hxx
@@ -264,6 +264,26 @@ struct JavaInfo
 JVMFWK_DLLPUBLIC void jfw_freeJavaInfo(JavaInfo *pInfo);
 
 
+namespace jfw {
+
+struct JavaInfoGuard {
+    JavaInfoGuard(JavaInfoGuard &) = delete;
+    void operator =(JavaInfoGuard) = delete;
+
+    JavaInfoGuard(): info(nullptr) {}
+
+    ~JavaInfoGuard() { delete info; }
+
+    void clear() {
+        delete info;
+        info = nullptr;
+    }
+
+    JavaInfo * info;
+};
+
+}
+
 /** compares two <code>JavaInfo</code> objects for equality.
 
    <p>Two <code>JavaInfo</code> objects are said to be equal if the contained


More information about the Libreoffice-commits mailing list