Skip to content

Terminal tabs: libc++abi: terminating due to uncaught exception of type std::bad_optional_access: bad_optional_access #1730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
whisperity opened this issue Mar 2, 2025 · 1 comment · May be fixed by #1739
Labels
bug Something isn't working frontend Contour Terminal Emulator (GUI frontend)

Comments

@whisperity
Copy link
Member

Contour Terminal version

0.6.1.7494

Installer source

GitHub: release page

Operating System

MacOS San Sequoia 15.3.1

Architecture

ARM64

Other Software

Steps to reproduce

  1. Start contour normally, as you would.
  2. Identify this session with echo 1.
  3. Execute NewTerminal to get another window. Both windows now point at the newly created shell ([0.6.1.7494 Regression] Switching between windows of the same Contour process broken (likely due to terminal tabs feature) #1725).
  4. Identify this session with echo 2.
  5. Type exit into shell 2 in the old (originally opened) window.
  6. Shell 2 exits, and the older window returns back to shell 1. The newer window is still "running" the exit prompt and the window is open.

Left contour back to shell 1, right contour is still "running" the "exit".

  1. Now also exit shell 1. The older window closes.
  2. Click into the newer (only remaining) window and try to SwitchTabToLeft or SwitchTabToRight (might be related to Terminal tabs: SwitchTabToLeft/SwitchTabToRight keybind is executed not in the active window #1728). A crash happens.

Expected Behavior

No crash. If there are no other sessions remaining, I think the following two options are reasonable:

  1. Contour automatically executes CreateNewTab and switches to that session.
  2. Contour doesn't switch to any session automatically, but run a logic similar to the "The shell exited too quickly..." prompt with bright red background and tell the user "Hey, we ran out of tabs/sessions, please start a new terminal".

Of course, the issue is deeper rooted I believe. Either it should not be possible for two windows to be attached to the same tab, or if a tab is exited while there are more than 1 window attached to it, all the other tabs should print an error message raw to the GUI as in the 2nd point above.

Actual Behavior

[2025-03-02 14:54:21.253752] [gui.session] ExitWatcherThread: Terminal device closed.
[2025-03-02 14:54:21.253762] [vt.session] PTY read failed. Resource temporarily unavailable
[2025-03-02 14:54:21.253768] [pty.input] master received: ""
[2025-03-02 14:54:21.253770] [vt.session] PTY read returned with zero bytes. Closing PTY.
[2025-03-02 14:54:21.253774] [pty] PTY closing master from thread Terminal.Loop (file descriptor 12).
[2025-03-02 14:54:21.253785] [gui.session] Event loop terminating (PTY closed).
[2025-03-02 14:54:21.253790] [gui.session] Terminal device closed (thread )
[2025-03-02 14:54:21.253800] [gui.session] Process terminated after 132 seconds with exit status 0 (normal exit).
[2025-03-02 14:54:21.253807] [gui.session_manager] REMOVE SESSION: session: 0x150008000, _sessions.size(): 1
[2025-03-02 14:54:21.253811] [gui.session_manager] Calculated next "previous" session index 18446744073709551615
[2025-03-02 14:54:21.253815] [gui.session] Terminal device is closed. Closing display.
[2025-03-02 14:54:21.253818] [gui.display] closeDisplay
Debug[qml]: Client process terminated. Closing the window. (qrc:/contour/ui/Terminal.qml:210, expression for onTerminated)
[2025-03-02 14:54:27.809866] [gui.input] Mouse press received:  Left
[2025-03-02 14:54:27.809961] [vt.input] Creating cell selector: LinearSelection(Waiting from (4, 19) to (4, 19))
[2025-03-02 14:54:28.296857] [gui.input] Key Press event received: Control LeftControl
[2025-03-02 14:54:28.379890] [gui.input] Input not handled for mods Shift|Control key 0x1000020
[2025-03-02 14:54:29.090925] [gui.input] Character Press event received: Shift|Control 'L'
[2025-03-02 14:54:29.091021] [gui.session] executeAction: SwitchToTabRight
libc++abi: terminating due to uncaught exception of type std::bad_optional_access: bad_optional_access
[2]    34879 abort      contour debug '*'
Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	       0x19ab2f720 __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x19ab67f70 pthread_kill + 288
2   libsystem_c.dylib             	       0x19aa74908 abort + 128
3   libc++abi.dylib               	       0x19ab1e44c abort_message + 132
4   libc++abi.dylib               	       0x19ab0ca24 demangling_terminate_handler() + 320
5   libobjc.A.dylib               	       0x19a7b53f4 _objc_terminate() + 172
6   libc++abi.dylib               	       0x19ab1d710 std::__terminate(void (*)()) + 16
7   libc++abi.dylib               	       0x19ab1d6b4 std::terminate() + 108
8   contour                       	       0x10455d740 contour::TerminalSessionManager::qt_metacall(QMetaObject::Call, int, void**) + 156
9   QtQml                         	       0x106c90110 QV4::CallMethod(QQmlObjectOrGadget const&, int, QMetaType, int, QMetaType const*, QV4::ExecutionEngine*, QV4::CallData*, QMetaObject::Call) + 4228
10  QtQml                         	       0x106c8c334 QV4::CallPrecise(QQmlObjectOrGadget const&, QQmlPropertyData const&, QV4::ExecutionEngine*, QV4::CallData*, QMetaObject::Call) + 436
11  QtQml                         	       0x106c895b8 QV4::QObjectMethod::callInternal(QV4::Value const*, QV4::Value const*, int) const + 1608
12  QtQml                         	       0x106ccbb08 QV4::Moth::VME::interpret(QV4::JSTypesStackFrame*, QV4::ExecutionEngine*, char const*) + 4088
13  QtQml                         	       0x106ccaa70 QV4::Moth::VME::exec(QV4::JSTypesStackFrame*, QV4::ExecutionEngine*) + 220
14  QtQml                         	       0x106c521a4 QV4::doCall(QV4::Function*, QV4::Value const*, QV4::Value const*, int, QV4::ExecutionContext*) + 168
15  QtQml                         	       0x106c51b10 QV4::Function::call(QObject*, void**, QMetaType const*, int, QV4::ExecutionContext*) + 532
16  QtQml                         	       0x106d54e60 QQmlJavaScriptExpression::evaluate(void**, QMetaType const*, int) + 124
17  QtQml                         	       0x106d15e5c QQmlBoundSignalExpression::evaluate(void**) + 452
18  QtQml                         	       0x106d1629c QQmlBoundSignal_callback(QQmlNotifierEndpoint*, void**) + 292
19  QtQml                         	       0x106d6eea0 QQmlNotifier::emitNotify(QQmlNotifierEndpoint*, void**) + 460
20  QtCore                        	       0x107e558dc void doActivate<false>(QObject*, int, void**) + 152
21  QtQml                         	       0x106ddca84 QQmlVMEMetaObject::metaCall(QObject*, QMetaObject::Call, int, void**) + 4432
22  QtQml                         	       0x106c90110 QV4::CallMethod(QQmlObjectOrGadget const&, int, QMetaType, int, QMetaType const*, QV4::ExecutionEngine*, QV4::CallData*, QMetaObject::Call) + 4228
23  QtQml                         	       0x106c8c334 QV4::CallPrecise(QQmlObjectOrGadget const&, QQmlPropertyData const&, QV4::ExecutionEngine*, QV4::CallData*, QMetaObject::Call) + 436
24  QtQml                         	       0x106c895b8 QV4::QObjectMethod::callInternal(QV4::Value const*, QV4::Value const*, int) const + 1608
25  QtQml                         	       0x106c8de7c QV4::QObjectSlotDispatcher::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) + 572
26  QtCore                        	       0x107e55cf4 void doActivate<false>(QObject*, int, void**) + 1200
27  contour                       	       0x104618540 decltype(auto) std::__1::__variant_detail::__visitation::__base::__dispatcher<56ul>::__dispatch[abi:ue170006]<std::__1::__variant_detail::__visitation::__variant::__value_visitor<contour::TerminalSession&>&&, std::__1::__variant_detail::__base<(std::__1::__variant_detail::_Trait)1, contour::actions::CancelSelection, contour::actions::ChangeProfile, contour::actions::ClearHistoryAndReset, contour::actions::CopyPreviousMarkRange, contour::actions::CopySelection, contour::actions::CreateDebugDump, contour::actions::CreateSelection, contour::actions::DecreaseFontSize, contour::actions::DecreaseOpacity, contour::actions::FocusNextSearchMatch, contour::actions::FocusPreviousSearchMatch, contour::actions::FollowHyperlink, contour::actions::IncreaseFontSize, contour::actions::IncreaseOpacity, contour::actions::NewTerminal, contour::actions::NoSearchHighlight, contour::actions::OpenConfiguration, contour::actions::OpenFileManager, contour::actions::OpenSelection, contour::actions::PasteClipboard, contour::actions::PasteSelection, contour::actions::Quit, contour::actions::ReloadConfig, contour::actions::ResetConfig, contour::actions::ResetFontSize, contour::actions::ScreenshotVT, contour::actions::SaveScreenshot, contour::actions::CopyScreenshot, contour::actions::ScrollDown, contour::actions::ScrollMarkDown, contour::actions::ScrollMarkUp, contour::actions::ScrollOneDown, contour::actions::ScrollOneUp, contour::actions::ScrollPageDown, contour::actions::ScrollPageUp, contour::actions::ScrollToBottom, contour::actions::ScrollToTop, contour::actions::ScrollUp, contour::actions::SearchReverse, contour::actions::SendChars, contour::actions::ToggleAllKeyMaps, contour::actions::ToggleFullscreen, contour::actions::ToggleInputProtection, contour::actions::ToggleStatusLine, contour::actions::ToggleTitleBar, contour::actions::TraceBreakAtEmptyQueue, contour::actions::TraceEnter, contour::actions::TraceLeave, contour::actions::TraceStep, contour::actions::ViNormalMode, contour::actions::WriteScreen, contour::actions::CreateNewTab, contour::actions::CloseTab, contour::actions::SwitchToTab, contour::actions::SwitchToPreviousTab, contour::actions::SwitchToTabLeft, contour::actions::SwitchToTabRight> const&>(std::__1::__variant_detail::__visitation::__variant::__value_visitor<contour::TerminalSession&>&&, std::__1::__variant_detail::__base<(std::__1::__variant_detail::_Trait)1, contour::actions::CancelSelection, contour::actions::ChangeProfile, contour::actions::ClearHistoryAndReset, contour::actions::CopyPreviousMarkRange, contour::actions::CopySelection, contour::actions::CreateDebugDump, contour::actions::CreateSelection, contour::actions::DecreaseFontSize, contour::actions::DecreaseOpacity, contour::actions::FocusNextSearchMatch, contour::actions::FocusPreviousSearchMatch, contour::actions::FollowHyperlink, contour::actions::IncreaseFontSize, contour::actions::IncreaseOpacity, contour::actions::NewTerminal, contour::actions::NoSearchHighlight, contour::actions::OpenConfiguration, contour::actions::OpenFileManager, contour::actions::OpenSelection, contour::actions::PasteClipboard, contour::actions::PasteSelection, contour::actions::Quit, contour::actions::ReloadConfig, contour::actions::ResetConfig, contour::actions::ResetFontSize, contour::actions::ScreenshotVT, contour::actions::SaveScreenshot, contour::actions::CopyScreenshot, contour::actions::ScrollDown, contour::actions::ScrollMarkDown, contour::actions::ScrollMarkUp, contour::actions::ScrollOneDown, contour::actions::ScrollOneUp, contour::actions::ScrollPageDown, contour::actions::ScrollPageUp, contour::actions::ScrollToBottom, contour::actions::ScrollToTop, contour::actions::ScrollUp, contour::actions::SearchReverse, contour::actions::SendChars, contour::actions::ToggleAllKeyMaps, contour::actions::ToggleFullscreen, contour::actions::ToggleInputProtection, contour::actions::ToggleStatusLine, contour::actions::ToggleTitleBar, contour::actions::TraceBreakAtEmptyQueue, contour::actions::TraceEnter, contour::actions::TraceLeave, contour::actions::TraceStep, contour::actions::ViNormalMode, contour::actions::WriteScreen, contour::actions::CreateNewTab, contour::actions::CloseTab, contour::actions::SwitchToTab, contour::actions::SwitchToPreviousTab, contour::actions::SwitchToTabLeft, contour::actions::SwitchToTabRight> const&) + 16
28  contour                       	       0x10460c01c contour::TerminalSession::executeAllActions(std::__1::vector<std::__1::variant<contour::actions::CancelSelection, contour::actions::ChangeProfile, contour::actions::ClearHistoryAndReset, contour::actions::CopyPreviousMarkRange, contour::actions::CopySelection, contour::actions::CreateDebugDump, contour::actions::CreateSelection, contour::actions::DecreaseFontSize, contour::actions::DecreaseOpacity, contour::actions::FocusNextSearchMatch, contour::actions::FocusPreviousSearchMatch, contour::actions::FollowHyperlink, contour::actions::IncreaseFontSize, contour::actions::IncreaseOpacity, contour::actions::NewTerminal, contour::actions::NoSearchHighlight, contour::actions::OpenConfiguration, contour::actions::OpenFileManager, contour::actions::OpenSelection, contour::actions::PasteClipboard, contour::actions::PasteSelection, contour::actions::Quit, contour::actions::ReloadConfig, contour::actions::ResetConfig, contour::actions::ResetFontSize, contour::actions::ScreenshotVT, contour::actions::SaveScreenshot, contour::actions::CopyScreenshot, contour::actions::ScrollDown, contour::actions::ScrollMarkDown, contour::actions::ScrollMarkUp, contour::actions::ScrollOneDown, contour::actions::ScrollOneUp, contour::actions::ScrollPageDown, contour::actions::ScrollPageUp, contour::actions::ScrollToBottom, contour::actions::ScrollToTop, contour::actions::ScrollUp, contour::actions::SearchReverse, contour::actions::SendChars, contour::actions::ToggleAllKeyMaps, contour::actions::ToggleFullscreen, contour::actions::ToggleInputProtection, contour::actions::ToggleStatusLine, contour::actions::ToggleTitleBar, contour::actions::TraceBreakAtEmptyQueue, contour::actions::TraceEnter, contour::actions::TraceLeave, contour::actions::TraceStep, contour::actions::ViNormalMode, contour::actions::WriteScreen, contour::actions::CreateNewTab, contour::actions::CloseTab, contour::actions::SwitchToTab, contour::actions::SwitchToPreviousTab, contour::actions::SwitchToTabLeft, contour::actions::SwitchToTabRight>, std::__1::allocator<std::__1::variant<contour::actions::CancelSelection, contour::actions::ChangeProfile, contour::actions::ClearHistoryAndReset, contour::actions::CopyPreviousMarkRange, contour::actions::CopySelection, contour::actions::CreateDebugDump, contour::actions::CreateSelection, contour::actions::DecreaseFontSize, contour::actions::DecreaseOpacity, contour::actions::FocusNextSearchMatch, contour::actions::FocusPreviousSearchMatch, contour::actions::FollowHyperlink, contour::actions::IncreaseFontSize, contour::actions::IncreaseOpacity, contour::actions::NewTerminal, contour::actions::NoSearchHighlight, contour::actions::OpenConfiguration, contour::actions::OpenFileManager, contour::actions::OpenSelection, contour::actions::PasteClipboard, contour::actions::PasteSelection, contour::actions::Quit, contour::actions::ReloadConfig, contour::actions::ResetConfig, contour::actions::ResetFontSize, contour::actions::ScreenshotVT, contour::actions::SaveScreenshot, contour::actions::CopyScreenshot, contour::actions::ScrollDown, contour::actions::ScrollMarkDown, contour::actions::ScrollMarkUp, contour::actions::ScrollOneDown, contour::actions::ScrollOneUp, contour::actions::ScrollPageDown, contour::actions::ScrollPageUp, contour::actions::ScrollToBottom, contour::actions::ScrollToTop, contour::actions::ScrollUp, contour::actions::SearchReverse, contour::actions::SendChars, contour::actions::ToggleAllKeyMaps, contour::actions::ToggleFullscreen, contour::actions::ToggleInputProtection, contour::actions::ToggleStatusLine, contour::actions::ToggleTitleBar, contour::actions::TraceBreakAtEmptyQueue, contour::actions::TraceEnter, contour::actions::TraceLeave, contour::actions::TraceStep, contour::actions::ViNormalMode, contour::actions::WriteScreen, contour::actions::CreateNewTab, contour::actions::CloseTab, contour::actions::SwitchToTab, contour::actions::SwitchToPreviousTab, contour::actions::SwitchToTabLeft, contour::actions::SwitchToTabRight>>> const&) + 200
29  contour                       	       0x10460c538 contour::TerminalSession::sendCharEvent(char32_t, unsigned int, crispy::flags<vtbackend::Modifier>, vtbackend::KeyboardEventType, std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l>>>) + 808
30  contour                       	       0x10462831c contour::sendKeyEvent(QKeyEvent*, vtbackend::KeyboardEventType, contour::TerminalSession&) + 516
31  QtQuick                       	       0x10658f994 QQuickItemPrivate::deliverKeyEvent(QKeyEvent*) + 148
32  QtQuick                       	       0x106594c88 QQuickItem::event(QEvent*) + 176
33  contour                       	       0x10464a0a0 contour::display::TerminalDisplay::event(QEvent*) + 96
34  QtWidgets                     	       0x1058b3f28 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 272
35  QtWidgets                     	       0x1058b4e5c QApplication::notify(QObject*, QEvent*) + 516
36  QtCore                        	       0x107e1c4ec QCoreApplication::notifyInternal2(QObject*, QEvent*) + 204
37  QtQuick                       	       0x1066b02c4 QQuickDeliveryAgentPrivate::deliverKeyEvent(QKeyEvent*) + 292
38  QtGui                         	       0x1077e3510 QWindow::event(QEvent*) + 724
39  QtQuick                       	       0x1066126d4 QQuickWindow::event(QEvent*) + 3688
40  QtQuick                       	       0x10661d8a8 QQuickWindowQmlImpl::event(QEvent*) + 444
41  QtWidgets                     	       0x1058b3f28 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 272
42  QtWidgets                     	       0x1058b4e5c QApplication::notify(QObject*, QEvent*) + 516
43  QtCore                        	       0x107e1c4ec QCoreApplication::notifyInternal2(QObject*, QEvent*) + 204
44  QtGui                         	       0x1077a1c34 QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) + 252
45  QtGui                         	       0x1077e8dc4 QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 132
46  QtGui                         	       0x1077e8b38 QWindowSystemInterface::flushWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 200
47  libqcocoa.dylib               	       0x1085aa28c -[QNSView(Keys) handleKeyEvent:] + 972
48  libqcocoa.dylib               	       0x1085aaee0 -[QNSView(Keys) keyDown:] + 76
49  AppKit                        	       0x19e8ed6b4 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 316
50  AppKit                        	       0x19e8ed3a8 -[NSWindow(NSEventRouting) sendEvent:] + 284
51  libqcocoa.dylib               	       0x1085b17d8 -[QNSWindow sendEvent:] + 788
52  AppKit                        	       0x19f12bcc8 -[NSApplication(NSEventRouting) sendEvent:] + 2360
53  libqcocoa.dylib               	       0x10855fe08 -[QNSApplication sendEvent:] + 68
54  AppKit                        	       0x19ed32b04 -[NSApplication _handleEvent:] + 60
55  AppKit                        	       0x19e7b989c -[NSApplication run] + 520
56  libqcocoa.dylib               	       0x10856b3f4 QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 1932
57  QtCore                        	       0x107e230c8 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 448
58  QtCore                        	       0x107e1ca24 QCoreApplication::exec() + 112
59  contour                       	       0x1045f6518 contour::ContourGuiApp::terminalGuiAction() + 2828
60  contour                       	       0x104652898 crispy::app::run(int, char const**) + 816
61  contour                       	       0x104570bd0 main + 88
62  dyld                          	       0x19a7e8274 start + 2840

Additional notes

Other terminal multiplexer solutions such as screen, dtach, monomux, and tmux(byobu) all explicitly print something like [exited] when the session their "frontend" was attached to is quit.

@whisperity whisperity added bug Something isn't working frontend Contour Terminal Emulator (GUI frontend) labels Mar 2, 2025
@Yaraslaut
Copy link
Member

Similar to: #1728

@Yaraslaut Yaraslaut linked a pull request Mar 26, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend Contour Terminal Emulator (GUI frontend)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants