changeset 26635:931ace437d5d stable

fix possible memleak by avoiding bare poointer (bug #55440) * shortcut-manager.cc (do_import_export): do not use a pointer for the QSettings object that is used for importing or esporting custom shortcuts
author Torsten <mttl@mailbox.org>
date Sat, 26 Jan 2019 22:17:18 +0100
parents 48ddf51a6ef7
children 803006651db5
files libgui/src/shortcut-manager.cc
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/shortcut-manager.cc	Sat Jan 26 15:27:06 2019 -0500
+++ b/libgui/src/shortcut-manager.cc	Sat Jan 26 22:17:18 2019 +0100
@@ -693,9 +693,9 @@
         if (file.isEmpty ())
           return false;
 
-        QSettings *osc_settings = new QSettings (file, QSettings::IniFormat);
+        QSettings osc_settings (file, QSettings::IniFormat);
 
-        if (! osc_settings)
+        if (osc_settings.status () !=  QSettings::NoError)
           {
             qWarning () << tr ("Failed to open %1 as Octave shortcut file")
                         .arg (file);
@@ -704,9 +704,9 @@
         else
           {
             if (action == OSC_IMPORT)
-              import_shortcuts (osc_settings);   // import (special action)
+              import_shortcuts (&osc_settings);   // import (special action)
             else if (action == OSC_EXPORT)
-              do_write_shortcuts (osc_settings, false); // export, (save settings)
+              do_write_shortcuts (&osc_settings, false); // export, (save settings)
           }
       }
     else