SLADE 3.2.8 Crash On Tab Switch: A Deep Dive

by SLV Team 45 views
SLADE 3.2.8 Crash on Tab Switch: A Deep Dive

Hey guys! Today, we're diving into a tricky issue reported with SLADE, the popular Doom editing tool. Specifically, we're talking about a crash happening in version 3.2.8 on Windows 11. Buckle up, because we're going to dissect this thing and see what's going on.

The Reported Problem

So, here's the deal. Users are experiencing crashes while using the resource editor in SLADE. The crash seems to occur when switching between tabs in the main editor window. This can be super frustrating when you're in the middle of a big project, right? Nobody wants to lose their work due to a software glitch.

SLADE Version and OS Details

  • SLADE Version: 3.2.8
  • Operating System: Windows 11 (build 26220), 64-bit edition

Steps to Reproduce (or Rather, Avoid!)

The user, sirjuddington, mentioned they "Avoided The Build Crash". This suggests the issue isn't 100% consistent, which can make it even harder to pin down. However, the core action leading to the crash seems to be related to tab switching within the resource editor.

Diving into the Crash Information

Let's get technical for a moment and look at the juicy bits from the crash log. Understanding the stack trace can give us clues about where the problem lies.

Version: 3.2.8 (x64)
No current action

Operating System: Windows 11 (build 26220), 64-bit edition
Graphics Vendor: Intel
Graphics Hardware: Intel(R) UHD Graphics 620
OpenGL Version: 4.6.0 - Build 31.0.101.2112

Stack Trace:
0: (H:\Dev\SLADE\Build\thirdparty\sigslot\signal.hpp:335) sigslot::connection::disconnect
1: (H:\Dev\SLADE\Build\src\UI\Controls\UndoManagerHistoryPanel.cpp:149) slade::UndoListView::connectManagerSignals
2: (H:\Dev\SLADE\Build\src\UI\Controls\UndoManagerHistoryPanel.cpp:118) slade::UndoListView::setManager
3: (H:\Dev\SLADE\Build\src\MainEditor\UI\MainWindow.cpp:748) slade::MainWindow::onTabChanged
4: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\appbase.cpp:675) wxAppConsoleBase::CallEventHandler
5: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\event.cpp:1476) wxEvtHandler::ProcessEventIfMatchesId
6: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\event.cpp:1928) wxEvtHandler::SearchDynamicEventTable
7: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\event.cpp:1651) wxEvtHandler::TryHereOnly
8: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\event.cpp:1588) wxEvtHandler::ProcessEventLocally
9: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\event.cpp:1561) wxEvtHandler::ProcessEvent
10: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\wincmn.cpp:3507) wxWindowBase::TryAfter
11: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\event.cpp:1574) wxEvtHandler::ProcessEvent
12: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\aui\auibook.cpp:4188) wxAuiNotebook::DoModifySelection
13: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\aui\auibook.cpp:2743) wxAuiNotebook::SetSelectionToWindow
14: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\aui\auibook.cpp:1456) wxAuiTabCtrl::OnLeftDown
15: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\appbase.cpp:675) wxAppConsoleBase::CallEventHandler
16: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\event.cpp:1476) wxEvtHandler::ProcessEventIfMatchesId
17: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\event.cpp:1074) wxEventHashTable::HandleEvent
18: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\event.cpp:1655) wxEvtHandler::TryHereOnly
19: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\event.cpp:1588) wxEvtHandler::ProcessEventLocally
20: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\event.cpp:1561) wxEvtHandler::ProcessEvent
21: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\include\wx\private\safecall.h:40) wxSafeCall<bool,<lambda_b6a58eb521b3b09013e61b3db23e23f0>,<lambda_12f0070881acf234406bffbbbe3d004d> >
22: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\event.cpp:1684) wxEvtHandler::SafelyProcessEvent
23: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\msw\window.cpp:5980) wxWindow::HandleMouseEvent
24: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\msw\window.cpp:3217) wxWindow::MSWHandleMessage
25: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\msw\window.cpp:3929) wxWindow::MSWWindowProc
26: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\msw\window.cpp:2974) wxWndProc
27: [unknown location] CallWindowProcW
28: [unknown location] IsWindowUnicode
29: [unknown location] IsDialogMessageW
30: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\msw\window.cpp:2839) wxWindow::MSWSafeIsDialogMessage
31: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\msw\window.cpp:2731) wxWindow::MSWProcessMessage
32: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\msw\evtloop.cpp:103) wxGUIEventLoop::PreProcessMessage
33: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\msw\evtloop.cpp:121) wxGUIEventLoop::ProcessMessage
34: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\msw\evtloop.cpp:180) wxGUIEventLoop::Dispatch
35: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\evtloopcmn.cpp:252) wxEventLoopManual::ProcessEvents
36: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\evtloopcmn.cpp:288) wxEventLoopManual::DoRunLoop
37: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\include\wx\private\safecall.h:40) wxSafeCall<void,<lambda_3adaf8645b6f24e7d663ae0bf523a7b3>,<lambda_a3e3aa09527365b9237000b8f16ddd15> >
38: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\evtloopcmn.cpp:362) wxEventLoopManual::DoRun
39: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\evtloopcmn.cpp:88) wxEventLoopBase::Run
40: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\appbase.cpp:380) wxAppConsoleBase::MainLoop
41: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\init.cpp:576) <lambda_55f52858d80940f6ec9b71dd9892a712>::operator()
42: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\include\wx\private\safecall.h:40) wxSafeCall<int,<lambda_55f52858d80940f6ec9b71dd9892a712>,<lambda_075a77736bb54248ad29ffacf30d7563> >
43: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\common\init.cpp:557) wxEntryReal
44: (H:\Dev\SLADE\Build\msvc\build64\_deps\wxwidgets-src\src\msw\main.cpp:166) wxEntry
45: (D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288) __scrt_common_main_seh
46: [unknown location] BaseThreadInitThunk
47: [unknown location] RtlUserThreadStart

Key Observations from the Stack Trace:

  • sigslot::connection::disconnect: This suggests an issue with signal and slot connections, a common mechanism for communication between different parts of the application. It hints that something is being disconnected at the wrong time or in the wrong way.
  • slade::UndoListView::connectManagerSignals and slade::UndoListView::setManager: These lines point to the Undo/Redo functionality. It's possible the crash is related to how the undo manager is being handled when tabs are switched.
  • slade::MainWindow::onTabChanged: This is the event handler that's triggered when a tab is changed in the main window. This confirms that the crash is directly linked to the tab switching action.
  • wxAuiNotebook::DoModifySelection: wxAuiNotebook is a part of wxWidgets, the UI framework SLADE uses. This line indicates that the crash happens during the process of modifying the tab selection within the notebook control.

Potential Causes

Based on the stack trace and the information provided, here are a few potential causes for the crash:

  1. Race Condition: It's possible there's a race condition where the UndoManager is being accessed or modified by different threads simultaneously during the tab switch. This could lead to data corruption and a crash.
  2. Incorrect Signal Handling: The sigslot::connection::disconnect line suggests a potential issue with how signals and slots are being managed. Maybe a signal is being disconnected prematurely, leading to a dangling pointer or an invalid memory access.
  3. wxWidgets Bug: While less likely, there could be a bug within the wxAuiNotebook control itself, especially considering the interaction with the UndoManager. Different versions of wxWidgets might behave differently.
  4. Memory Corruption: The crash could be caused by memory corruption elsewhere in the application that is triggered when the tab switch occurs. This is harder to diagnose without more information.

Last Log Messages Analysis

Setting up the OpenGL context
Initialising OpenGL...
OpenGL Version: 4.6
Max Texture Size: 16384x16384
Checking extensions...
Vertex Buffer Objects supported
Point Sprites supported
Framebuffer Objects supported
Opening archive C:\Users\user\Downloads\eduke32_win32_20251023-10651-bf58c7b52\LiquidatorGameJoltEdition\Liquidator.zip
Opening took 7740 ms

The log messages don't seem directly related to the crash, but they do show that SLADE is successfully initializing OpenGL and opening a ZIP archive. The "Opening took 7740 ms" line might be a point of interest. Perhaps very large archive files exacerbate the issue, possibly by tying up resources and making the system more susceptible to race conditions during tab switches.

Possible Solutions and Workarounds

Okay, so what can you do about this crash? Here are a few ideas:

  1. Update Graphics Drivers: Since OpenGL is involved, make sure you have the latest graphics drivers installed for your Intel UHD Graphics 620. Sometimes, outdated drivers can cause unexpected issues.
  2. Try a Different SLADE Version: If possible, try using an older or newer version of SLADE to see if the issue persists. This can help determine if the crash is specific to version 3.2.8.
  3. Simplify the Project: If you're working on a large project, try simplifying it by removing unnecessary resources or splitting it into smaller parts. This might reduce the likelihood of triggering the crash.
  4. Avoid Rapid Tab Switching: As a temporary workaround, try avoiding rapid or excessive tab switching. Give SLADE a moment to catch its breath between switches.
  5. Check for Conflicting Software: Some software may conflict with SLADE. Try closing other applications running in the background to see if that resolves the issue.

Digging Deeper (for Developers)

If you're a developer familiar with SLADE's codebase, here are some areas to investigate:

  • Review UndoManager Integration: Carefully review how the UndoManager is integrated with the tab control (wxAuiNotebook). Pay attention to how undo/redo operations are handled during tab switches.
  • Examine Signal Connections: Investigate the signal and slot connections related to the UndoListView and ensure they are being properly managed. Look for any potential issues with dangling pointers or premature disconnections.
  • Implement Thread Safety: If the UndoManager is being accessed from multiple threads, ensure that proper synchronization mechanisms (e.g., mutexes, locks) are in place to prevent race conditions.
  • Debug with Logging: Add more detailed logging around the tab switch event handler and the UndoManager operations to get a better understanding of what's happening at the time of the crash.

Conclusion

The SLADE crash during tab switching appears to be a complex issue potentially related to signal handling, the UndoManager, or even underlying wxWidgets behavior. By understanding the stack trace and the potential causes, we can start to narrow down the problem and find a solution. Hopefully, the tips and suggestions outlined in this article can help you avoid the crash or, at least, provide some clues for further investigation. Happy Doom editing, guys!