From e67e3226c6317aa1b2247704a11ae1e9d34d7b93 Mon Sep 17 00:00:00 2001 From: Christoph Cullmann Date: Sat, 7 Jun 2025 19:07:46 +0200 Subject: [PATCH 1/2] don't try to add nullptr to layout fixes runtime error output: QLayout: Cannot add a null widget to QHBoxLayout/ --- src/widgets/ViewContainer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/widgets/ViewContainer.cpp b/src/widgets/ViewContainer.cpp index b74dff5b6..1c0332945 100644 --- a/src/widgets/ViewContainer.cpp +++ b/src/widgets/ViewContainer.cpp @@ -219,10 +219,14 @@ void TabbedViewContainer::konsoleConfigChanged() layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); - layout->addWidget(KonsoleSettings::searchTabsButton() == 0 ? _searchTabsButton : nullptr); + if (KonsoleSettings::searchTabsButton() == 0) { + layout->addWidget(_searchTabsButton); + } _searchTabsButton->setVisible(KonsoleSettings::searchTabsButton() == 0); - layout->addWidget(KonsoleSettings::closeTabButton() == 1 ? _closeTabButton : nullptr); + if (KonsoleSettings::closeTabButton() == 1) { + layout->addWidget(_closeTabButton); + } _closeTabButton->setVisible(KonsoleSettings::closeTabButton() == 1); QWidget *rightCornerWidget = new QWidget(); From 2ca067cd38a1ec51566bd28b88f2db4395745682 Mon Sep 17 00:00:00 2001 From: Christoph Cullmann Date: Sun, 8 Jun 2025 20:23:19 +0200 Subject: [PATCH 2/2] fix OpenBSD compile verified myself on 7.7 with kdesrc-build build from scratch most parts of the fix taken from openbsd/ports x11/kde-applications/konsole/patches --- src/UnixProcessInfo.cpp | 2 +- src/autotests/CMakeLists.txt | 4 ++++ src/autotests/TerminalInterfaceTest.cpp | 7 ++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/UnixProcessInfo.cpp b/src/UnixProcessInfo.cpp index 080c6e6b1..43ba75872 100644 --- a/src/UnixProcessInfo.cpp +++ b/src/UnixProcessInfo.cpp @@ -21,7 +21,7 @@ #include #include -#if defined(Q_OS_FREEBSD) || defined(Q_OS_OPEN_BSD) || defined(Q_OS_MACOS) +#if defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) || defined(Q_OS_MACOS) #include #include #endif diff --git a/src/autotests/CMakeLists.txt b/src/autotests/CMakeLists.txt index f9a8b6240..018858590 100644 --- a/src/autotests/CMakeLists.txt +++ b/src/autotests/CMakeLists.txt @@ -4,6 +4,10 @@ set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) set(KONSOLE_TEST_LIBS Qt::Test konsoleprivate konsolecharacters konsoledecoders konsoleapp) +if (CMAKE_SYSTEM_NAME MATCHES "OpenBSD") + set(KONSOLE_TEST_LIBS ${KONSOLE_TEST_LIBS} kvm) +endif() + # Temporary bypass for BKO 432379 if(BUILD_SHARED_LIBS) ecm_add_test(KeyboardTranslatorTest.cpp LINK_LIBRARIES ${KONSOLE_TEST_LIBS}) diff --git a/src/autotests/TerminalInterfaceTest.cpp b/src/autotests/TerminalInterfaceTest.cpp index e0b4acaae..d3cf7f210 100644 --- a/src/autotests/TerminalInterfaceTest.cpp +++ b/src/autotests/TerminalInterfaceTest.cpp @@ -21,6 +21,7 @@ #if defined(Q_OS_LINUX) #include #elif defined(Q_OS_OPENBSD) +#include #include #include #include @@ -232,11 +233,11 @@ void TerminalInterfaceTest::testTerminalInterfaceUsingSpy() QVERIFY(procExeTarget.open(QIODevice::ReadOnly)); QCOMPARE(QStringLiteral(procExeTarget.readAll()), command); #elif defined(Q_OS_OPENBSD) - kvm_t *kd = kvm_openfiles(NULL, NULL, NULL, O_RD_ONLY, NULL); + kvm_t *kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL); int count; - auto kProcStruct = ::kvm_getprocs(kd, KERN_PROC_PID, foregroundProcessId, &count); + auto kProcStruct = ::kvm_getprocs(kd, KERN_PROC_PID, foregroundProcessId, sizeof(struct kinfo_proc), &count); QCOMPARE(count, 1); - QCOMPARE(QStringLiteral(kProcStruct->p_comm), command); + QCOMPARE(QString::fromUtf8(kProcStruct->p_comm), command); kvm_close(kd); #endif