View Issue Details

IDProjectCategoryView StatusLast Update
0006178DarkRadiantGeneralpublic13.01.2024 05:34
Reporterorbweaver Assigned Toorbweaver  
Status closedResolutionfixed 
PlatformLinuxOSUbuntuOS Version22.04
Product Version3.6.0 
Fixed in Version3.8.0 
Summary0006178: Sporadic assertion failure on shutdown due to LocalBitmapArtProvider destruction
DescriptionA sporadic (but frequent) assertion failure occurs on shutdown on Linux. The assertion message is "../src/common/object.cpp(352): assert "m_count > 0" failed in DecRef(): invalid ref data count". It occurs perhaps once every 3 - 4 runs, and does not seem to require any specific UI interaction beyond starting DarkRadiant and immediately exiting.

Since this is a debug assertion not an actual segfault, it *probably* doesn't affect release builds.
Steps To Reproduce1. Start DarkRadiant on Linux with a debug build.
2. Exit.
3. Repeat until error occurs.
Additional Information* thread 0000001, name = 'darkradiant', stop reason = signal SIGTRAP
  * frame #0: 0x00007ffff63d5a7c`pthread_kill + 300
    frame 0000001: 0x00007ffff6381476`raise + 22
    frame 0000002: 0x00007ffff71acd05`wxGUIAppTraits::ShowAssertDialog(wxString const&) at utilsgtk.cpp:345:17
    frame 0000003: 0x00007ffff759bee7`ShowAssertDialog(wxString const&, int, wxString const&, wxString const&, wxString const&, wxAppTraits*) at appbase.cpp:1326:52
    frame 0000004: 0x00007ffff759c14c`wxAppConsoleBase::OnAssertFailure(wchar_t const*, int, wchar_t const*, wchar_t const*, wchar_t const*) at appbase.cpp:805:21
    frame 0000005: 0x00007ffff717c724`wxApp::OnAssertFailure(this=0x00005555560c7850, file=<unavailable>, line=<unavailable>, func=<unavailable>, cond=<unavailable>, msg=<unavailable>) at app.cpp:540:31
    frame 0000006: 0x00007ffff759d146`wxDefaultAssertHandler(wxString const&, int, wxString const&, wxString const&, wxString const&) at appbase.cpp:1116:34
    frame 0000007: 0x00007ffff7596578`wxOnAssert(char const*, int, char const*, char const*, char const*) at appbase.cpp:1193:23
    frame #8: 0x00007ffff760f3a6`wxRefCounter::DecRef(this=0x00007fffd4623490) at object.cpp:352:5
    frame 0000009: 0x00007ffff760f3e6`wxObject::UnRef(this=0x00007fffd41dde28) at object.cpp:388:26
    frame 0000010: 0x00007ffff722cbfc`wxArtProviderBitmapsHash_wxImplementation_HashTable::DeleteNode(_wxHashTable_NodeBase*) at artprov.cpp:44:1
    frame 0000011: 0x00007ffff75f7e68`_wxHashTableBase2::DeleteNodes(buckets=193, table=0x00005555562c13c0, dtor=(`wxArtProviderBitmapsHash_wxImplementation_HashTable::DeleteNode(_wxHashTable_NodeBase*)))(_wxHashTable_NodeBase*)) at hashmap.cpp:106:17
    frame 0000012: 0x00007ffff722e9eb`wxArtProviderCache::Clear() [inlined] wxArtProviderBitmapsHash_wxImplementation_HashTable::clear(this=0x00005555561e8540) at artprov.cpp:44:1
    frame 0000013: 0x00007ffff722e9d8`wxArtProviderCache::Clear(this=0x00005555561e8540) at artprov.cpp:102:24
    frame 0000014: 0x00007ffff722f153`wxArtProvider::Remove(provider=<unavailable>) at artprov.cpp:184:24
    frame 0000015: 0x0000555555bf98ea darkradiant`wxutil::LocalBitmapArtProvider::~LocalBitmapArtProvider(this=0x0000555556905dc0) at LocalBitmapArtProvider.h:34:30
    frame 0000016: 0x0000555555bf9926 darkradiant`wxutil::LocalBitmapArtProvider::~LocalBitmapArtProvider(this=0x0000555556905dc0) at LocalBitmapArtProvider.h:35:5
    frame 0000017: 0x0000555555bfaa05 darkradiant`std::default_delete<wxutil::LocalBitmapArtProvider>::operator(this=0x00005555560c7c08, __ptr=0x0000555556905dc0)(wxutil::LocalBitmapArtProvider*) const at unique_ptr.h:85:2
    frame 0000018: 0x0000555555bfaa68 darkradiant`std::__uniq_ptr_impl<wxutil::LocalBitmapArtProvider, std::default_delete<wxutil::LocalBitmapArtProvider> >::reset(this=0x00005555560c7c08, __p=0x0000000000000000) at unique_ptr.h:182:16
    frame 0000019: 0x0000555555bfa4c7 darkradiant`std::unique_ptr<wxutil::LocalBitmapArtProvider, std::default_delete<wxutil::LocalBitmapArtProvider> >::reset(this=nullptr, __p=0x0000000000000000) at unique_ptr.h:456:12
    frame 0000020: 0x0000555555bf7951 darkradiant`RadiantApp::cleanupWxWidgets(this=0x00005555560c7850) at RadiantApp.cpp:140:29
    frame 0000021: 0x0000555555bf79fc darkradiant`RadiantApp::OnExit(this=0x00005555560c7850) at RadiantApp.cpp:159:21
    frame 0000022: 0x00007ffff7600be2`wxEntry(int&, wchar_t**) at init.cpp:500:45
    frame 0000023: 0x0000555555bedd2d darkradiant`main(argc=1, argv=0x00007fffffffded8) at main.cpp:7:1
    frame 0000024: 0x00007ffff6368d90`___lldb_unnamed_symbol3139 + 128
    frame 0000025: 0x00007ffff6368e40`__libc_start_main + 128
    frame 0000026: 0x0000555555afd6f5 darkradiant`_start + 37
TagsNo tags attached.




13.12.2022 21:30

developer   ~0015559

After refactoring the LocalBitmapArtProvider into a local class inside RadiantApp (instead of a header in wxutil) I have not seen this assertion again. Since it was intermittent to begin with, I cannot be sure it is fixed, but at least it seems to have been made sufficiently rare that it is not presenting serious annoyance during development.

Related Changesets

DarkRadiant: master da8002c3

23.11.2022 20:52


Details Diff
0006178: DEBUG_CULLING is disabled by default

This is triggering a lot of uninitialised value errors in Valgrind (of
uncertain cause), and is unlikely to be useful for development tasks
that don't specifically relate to culling.
Affected Issues
mod - libs/render/View.h Diff File

DarkRadiant: master 751cd7ad

23.11.2022 21:21


Details Diff
0006178: LocalBitmapArtProvider uses wxBitmap::LoadFile()

The previous approach of constructing a wxBitmap from a temporary
wxImage was leading to an uninitialised data warning in Valgrind,
although it does not seem to be related to the assertion on shutdown
(which still appears after this change).
Affected Issues
mod - libs/wxutil/LocalBitmapArtProvider.h Diff File

DarkRadiant: master 59ec3282

29.11.2022 20:32


Details Diff
0006178: avoid potential use of initialised size vector in TextureThumbnailBrowser

Valgrind flagged up a possible "jump based on uninitialised value",
which appeared to be caused by the _viewportSize vector in
TextureThumbnailBrowser. This vector was left uninitialised at
construction, and subsequently set to a real value after receiving a
wxEVT_SIZE event, which is not guaranteed to happen.

The _viewportSize value is now an std::optional which is initialised on
demand when the getViewportSize() private method is called (as well as
being updated by the wxEVT_SIZE event as before).
Affected Issues
mod - radiant/ui/texturebrowser/TextureBrowserPanel.cpp Diff File
mod - radiant/ui/texturebrowser/TextureThumbnailBrowser.cpp Diff File
mod - radiant/ui/texturebrowser/TextureThumbnailBrowser.h Diff File

DarkRadiant: master c8fe8ce0

29.11.2022 21:01


Details Diff
0006178: fix a couple more uninitialised values Affected Issues
mod - libs/wxutil/ConsoleView.h Diff File
mod - radiant/ui/texturebrowser/TextureThumbnailBrowser.h Diff File

DarkRadiant: master dc63b7c4

29.11.2022 21:11


Details Diff
0006178: fix potentially uninitialised matrices in XYWnd

This seems to be the last of the Valgrind warnings that appear before
the main window is shown, other than those which appear in third-party
code (e.g. wxWidgets) and probably aren't fixable on our side.
Affected Issues
mod - radiant/xyview/XYWnd.cpp Diff File
mod - radiant/xyview/XYWnd.h Diff File

DarkRadiant: master 5363c1c2

30.11.2022 20:34


Details Diff
0006178: ArtProvider is now local to RadiantApp class

LocalBitmapArtProvider was only ever constructed and owned by
RadiantApp; the reason it was exposed as a wxutil header was for the
ArtIdPrefix() method, which was used in a single other header

LocalBitmapArtProvider is now RadiantApp::ArtProvider, a local nested
class which is not exposed anywhere else. The functions in Bitmap.h just
use the "darkradiant:" prefix explicitly, which could be seen as
duplication but (1) the prefix is very unlikely to change, and (2) the
redundancy isn't serious enough to justify exposing the art provider
class and its method(s) through several headers and their dependent
shared objects.

Also removed the LocalBitmapArtProvider destructor which explicitly
removed the art provider from wxWidgets. This appeared to be redundant
because the wxArtProvider base class already does this in its own
destructor (according to documentation).
Affected Issues
mod - libs/wxutil/Bitmap.h Diff File
rm - libs/wxutil/LocalBitmapArtProvider.h Diff
mod - radiant/RadiantApp.cpp Diff File
mod - radiant/RadiantApp.h Diff File
mod - radiant/ui/materials/editor/MaterialEditor.cpp Diff File
mod - radiant/ui/skin/SkinEditor.cpp Diff File
mod - radiant/xyview/GlobalXYWnd.cpp Diff File

DarkRadiant: master 51c3bd61

26.12.2022 05:33


Details Diff
0006178: Update VC++ project Affected Issues
mod - tools/msvc/wxutillib.vcxproj Diff File
mod - tools/msvc/wxutillib.vcxproj.filters Diff File

DarkRadiant: master d0af9d28

26.12.2022 09:07


Details Diff
0006178: Loading bitmaps through wxBitmap::LoadFile is not working in Windows, it's always sticking to the BMP handler it seems. Affected Issues
mod - radiant/RadiantApp.cpp Diff File

Issue History

Date Modified Username Field Change
22.11.2022 20:15 orbweaver New Issue
22.11.2022 20:15 orbweaver Status new => assigned
22.11.2022 20:15 orbweaver Assigned To => orbweaver
22.11.2022 20:16 orbweaver Description Updated
13.12.2022 21:30 orbweaver Status assigned => resolved
13.12.2022 21:30 orbweaver Resolution open => fixed
13.12.2022 21:30 orbweaver Fixed in Version => 3.8.0
13.12.2022 21:30 orbweaver Note Added: 0015559
26.12.2022 09:26 orbweaver Changeset attached => DarkRadiant master da8002c3
26.12.2022 09:26 orbweaver Changeset attached => DarkRadiant master 751cd7ad
26.12.2022 09:26 orbweaver Changeset attached => DarkRadiant master 59ec3282
26.12.2022 09:26 orbweaver Changeset attached => DarkRadiant master c8fe8ce0
26.12.2022 09:26 orbweaver Changeset attached => DarkRadiant master dc63b7c4
26.12.2022 09:26 orbweaver Changeset attached => DarkRadiant master 5363c1c2
26.12.2022 09:26 greebo Changeset attached => DarkRadiant master 51c3bd61
26.12.2022 09:26 greebo Changeset attached => DarkRadiant master d0af9d28
13.01.2024 05:34 greebo Status resolved => closed