[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [k3b] /: Fix crash on write start.
From: Leslie Zhai <xiangzhai83 () gmail ! com>
Date: 2016-09-12 9:23:38
Message-ID: E1bjNSk-0006B2-Tu () code ! kde ! org
[Download RAW message or body]
Git commit 390ddfa2eeb3406b48b958c960aed45e2831627f by Leslie Zhai.
Committed on 12/09/2016 at 09:22.
Pushed by lesliezhai into branch 'master'.
Fix crash on write start.
There are a lot of unchecking binOjbect is nullptr issues in k3b-2.0.3!
BUG: 346412
M +3 -2 libk3b/projects/datacd/k3bdatajob.cpp
M +9 -0 tests/CMakeLists.txt
A +35 -0 tests/k3bexternalbinmanagertest.cpp [License: GPL (v2+)]
A +27 -0 tests/k3bexternalbinmanagertest.h [License: GPL (v2+)]
http://commits.kde.org/k3b/390ddfa2eeb3406b48b958c960aed45e2831627f
diff --git a/libk3b/projects/datacd/k3bdatajob.cpp b/libk3b/projects/datacd/k3bdatajob.cpp
index 7cd0717..315845a 100644
--- a/libk3b/projects/datacd/k3bdatajob.cpp
+++ b/libk3b/projects/datacd/k3bdatajob.cpp
@@ -932,8 +932,9 @@ bool K3b::DataJob::waitForBurnMedium()
d->usedWritingApp = K3b::WritingAppCdrecord;
}
- if ( d->usedWritingApp == K3b::WritingAppCdrecord &&
- !k3bcore->externalBinManager()->binObject("cdrecord")->hasFeature( "blu-ray" ) ) {
+ if (d->usedWritingApp == K3b::WritingAppCdrecord &&
+ k3bcore->externalBinManager()->binObject("cdrecord") &&
+ !k3bcore->externalBinManager()->binObject("cdrecord")->hasFeature("blu-ray")) {
d->usedWritingApp = K3b::WritingAppGrowisofs;
}
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 72ea6d8..ac6c63c 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -55,3 +55,12 @@ target_link_libraries(k3bdeviceglobalstest
KF5::KIOCore
k3bdevice)
add_test(k3bdeviceglobalstest k3bdeviceglobalstest)
+
+add_executable(k3bexternalbinmanagertest k3bexternalbinmanagertest.cpp)
+target_include_directories(k3bexternalbinmanagertest PRIVATE
+ ${CMAKE_SOURCE_DIR}/libk3b)
+target_link_libraries(k3bexternalbinmanagertest
+ Qt5::Test
+ KF5::KIOCore
+ k3blib)
+add_test(k3bexternalbinmanagertest k3bexternalbinmanagertest)
diff --git a/tests/k3bexternalbinmanagertest.cpp b/tests/k3bexternalbinmanagertest.cpp
new file mode 100644
index 0000000..925077f
--- /dev/null
+++ b/tests/k3bexternalbinmanagertest.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2016 Leslie Zhai <xiangzhai83@gmail.com>
+ *
+ * This file is part of the K3b project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * See the file "COPYING" for the exact licensing terms.
+ */
+
+#include "k3bexternalbinmanagertest.h"
+#include "k3bexternalbinmanager.h"
+
+#include <QtTest/QTest>
+
+QTEST_GUILESS_MAIN(ExternalBinManagerTest)
+
+ExternalBinManagerTest::ExternalBinManagerTest()
+{
+}
+
+void ExternalBinManagerTest::testBinObject()
+{
+ K3b::ExternalBinManager* binManager = new K3b::ExternalBinManager;
+ if (binManager->binObject("ooo") && binManager->binObject("ooo")->hasFeature("fff")) {
+ qDebug() << __PRETTY_FUNCTION__ << "it *NEVER* happened!";
+ }
+ // ooo binObject directly return 0
+ // then hasFeature will segfault!
+ // there are a lot of unchecking binObject is nullptr issue in k3b-2.0.3!!!
+ //if (binManager->binObject("ooo")->hasFeature("fff")) {
+ //}
+}
diff --git a/tests/k3bexternalbinmanagertest.h b/tests/k3bexternalbinmanagertest.h
new file mode 100644
index 0000000..bf57853
--- /dev/null
+++ b/tests/k3bexternalbinmanagertest.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2016 Leslie Zhai <xiangzhai83@gmail.com>
+ *
+ * This file is part of the K3b project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * See the file "COPYING" for the exact licensing terms.
+ */
+
+#ifndef K3B_EXTERNAL_BINMANAGER_TEST_H
+#define K3B_EXTERNAL_BINMANAGER_TEST_H
+
+#include <QtCore/QObject>
+
+class ExternalBinManagerTest : public QObject
+{
+ Q_OBJECT
+public:
+ ExternalBinManagerTest();
+private slots:
+ void testBinObject();
+};
+
+#endif // K3B_EXTERNAL_BINMANAGER_TEST_H
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic