[vlc-commits] [Git][videolan/vlc][master] 3 commits: qt: fingerprintdialog: avoid unneeded null checks

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Sep 14 11:51:11 UTC 2022



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
bb9228a9 by Johannes Kauffmann at 2022-09-14T11:21:49+00:00
qt: fingerprintdialog: avoid unneeded null checks

As a drive-by, use nullptr instead of NULL.

- - - - -
fcf766a0 by Johannes Kauffmann at 2022-09-14T11:21:49+00:00
qt: compositor_x11_uisurface: avoid unneeded null checks

- - - - -
1e4b15f2 by Johannes Kauffmann at 2022-09-14T11:21:49+00:00
qt: avoid unneeded null checks

- - - - -


3 changed files:

- modules/gui/qt/dialogs/fingerprint/fingerprintdialog.cpp
- modules/gui/qt/maininterface/compositor_x11_uisurface.cpp
- modules/gui/qt/qt.cpp


Changes:

=====================================
modules/gui/qt/dialogs/fingerprint/fingerprintdialog.cpp
=====================================
@@ -31,7 +31,7 @@
 FingerprintDialog::FingerprintDialog(QWidget *parent, qt_intf_t *p_intf,
                                      input_item_t *p_item ) :
     QDialog(parent),
-    ui(new Ui::FingerprintDialog), p_r( NULL )
+    ui(new Ui::FingerprintDialog), p_r( nullptr )
 {
     ui->setupUi(this);
 
@@ -80,7 +80,7 @@ void FingerprintDialog::handleResults()
     if ( vlc_array_count( & p_r->results.metas_array ) == 0 )
     {
         fingerprint_request_Delete( p_r );
-        p_r = NULL;
+        p_r = nullptr;
         ui->stackedWidget->setCurrentWidget( ui->error );
         return;
     }
@@ -111,7 +111,7 @@ void FingerprintDialog::handleResults()
 
 FingerprintDialog::~FingerprintDialog()
 {
-    if ( t ) delete t;
-    if ( p_r ) fingerprint_request_Delete( p_r );
     delete ui;
+    delete t;
+    if ( p_r ) fingerprint_request_Delete( p_r );
 }


=====================================
modules/gui/qt/maininterface/compositor_x11_uisurface.cpp
=====================================
@@ -81,21 +81,15 @@ CompositorX11UISurface::~CompositorX11UISurface()
     // another surface that is valid for sure.
     m_context->makeCurrent(surface);
 
-    if (m_rootItem)
-        delete m_rootItem;
-    if (m_uiRenderControl)
-        delete m_uiRenderControl;
-    if (m_uiWindow)
-        delete m_uiWindow;
-    if (m_qmlEngine)
-        delete m_qmlEngine;
+    delete m_rootItem;
+    delete m_uiRenderControl;
+    delete m_uiWindow;
+    delete m_qmlEngine;
 
     m_context->doneCurrent();
 
     delete surface;
-    if (m_context)
-        delete m_context;
-
+    delete m_context;
 }
 
 


=====================================
modules/gui/qt/qt.cpp
=====================================
@@ -871,15 +871,13 @@ static void *ThreadCleanup( qt_intf_t *p_intf, CleanupReason cleanupReason )
         if (cleanupReason == CLEANUP_INTF_CLOSED)
         {
             p_intf->p_compositor->unloadGUI();
-            if (p_intf->p_mi)
-                delete p_intf->p_mi;
+            delete p_intf->p_mi;
             p_intf->p_mi = nullptr;
         }
         else // CLEANUP_APP_TERMINATED
         {
             p_intf->p_compositor->destroyMainInterface();
-            if (p_intf->p_mi)
-                delete p_intf->p_mi;
+            delete p_intf->p_mi;
             p_intf->p_mi = nullptr;
 
             delete p_intf->mainSettings;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/516a982d166fd678558d871d93d4f084da71cc4a...1e4b15f2b3295e89321da7a0b7ce7ec6bf2a0147

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/516a982d166fd678558d871d93d4f084da71cc4a...1e4b15f2b3295e89321da7a0b7ce7ec6bf2a0147
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list