Skip to content
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

Improvements for wx-qt, mainly for wx-qt on android #17

Closed
wants to merge 10 commits into from

Conversation

seandepagnier
Copy link
Contributor

No description provided.

@tierra
Copy link
Member

tierra commented Oct 20, 2014

Thank you for your contribution but we don't actually use Github
pull requests for this mirror of wxWidgets repository.

Please submit your changes to our Trac as explained here instead.

Thanks in advance!

the bionic library on android does not have gethostbyname_r even
though it has gethostbyname_r.  The configure script in wxwidgets
assumes if it has one it has the other.   This change does the right
thing for android, but perhaps the script should instead test for both?
@seandepagnier seandepagnier deleted the master branch November 25, 2014 23:09
vadz added a commit to vadz/wxWidgets that referenced this pull request Jan 31, 2021
This makes things much, much slower, but unfortunately seems to be the
only way to avoid memory leak reports when running the tests as without
it the suppression is not used because the stack is truncated, i.e. we
only see

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f0968253bc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
    #1 0x7f09675aacb8 in g_malloc ../../../glib/gmem.c:102

in the output when the actual stack, seen with fast_unwind_on_malloc=0, is

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f12b913bbc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
    #1 0x7f12b8496cd8 in g_malloc ../../../glib/gmem.c:102
    #2 0x7f12b84b0f93 in g_strdup ../../../glib/gstrfuncs.c:363
    #3 0x7f12b49adb2a in atk_bridge_adaptor_init ../atk-adaptor/bridge.c:1039
    #4 0x7f12b566d753 in _gtk_accessibility_init ../../../../gtk/a11y/gtkaccessibility.c:992
    #5 0x7f12b5821cfc in default_display_notify_cb ../../../../gtk/gtkmain.c:714
    #6 0x7f12b5589801 in g_closure_invoke ../../../gobject/gclosure.c:810
    #7 0x7f12b559d813 in signal_emit_unlocked_R ../../../gobject/gsignal.c:3742
    #8 0x7f12b55a8b9d in g_signal_emit_valist ../../../gobject/gsignal.c:3498
    #9 0x7f12b55a90d2 in g_signal_emit ../../../gobject/gsignal.c:3554
    #10 0x7f12b558e283 in g_object_dispatch_properties_changed ../../../gobject/gobject.c:1206
    #11 0x7f12b55906f1 in g_object_notify_by_spec_internal ../../../gobject/gobject.c:1299
    #12 0x7f12b55906f1 in g_object_notify ../../../gobject/gobject.c:1347
    #13 0x7f12b5dbf54f in _gdk_display_manager_add_display ../../../../gdk/gdkdisplaymanager.c:479
    #14 0x7f12b5589a55 in _g_closure_invoke_va ../../../gobject/gclosure.c:873
    wxWidgets#15 0x7f12b55a8b27 in g_signal_emit_valist ../../../gobject/gsignal.c:3407
    wxWidgets#16 0x7f12b55a9b7b in g_signal_emit_by_name ../../../gobject/gsignal.c:3594
    wxWidgets#17 0x7f12b5ded21a in _gdk_x11_display_open ../../../../../gdk/x11/gdkdisplay-x11.c:1803
    wxWidgets#18 0x7f12b5dbf377 in gdk_display_manager_open_display ../../../../gdk/gdkdisplaymanager.c:462
    wxWidgets#19 0x7f12b5822f6a in gtk_init_check ../../../../gtk/gtkmain.c:1109
    wxWidgets#20 0x7f12b5822f6a in gtk_init_check ../../../../gtk/gtkmain.c:1101
    wxWidgets#21 0x7f12b6fd1dad in wxApp::Initialize(int&, wchar_t**)
    ...
vadz added a commit to vadz/wxWidgets that referenced this pull request Jan 31, 2021
Somehow ASAN reports a memory leak in this test:

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7fc54732ebc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
    #1 0x7fc546685cb8 in g_malloc ../../../glib/gmem.c:102
    #2 0x7fc543a49b41 in _gtk_rbtree_new ../../../../gtk/gtkrbtree.c:333
    #3 0x7fc543b0831a in gtk_tree_view_real_expand_row ../../../../gtk/gtktreeview.c:12922
    #4 0x7fc543b1087a in gtk_tree_view_expand_row ../../../../gtk/gtktreeview.c:12983
    #5 0x7fc5453ba344 in wxDataViewCtrl::DoExpand(wxDataViewItem const&, bool) src/gtk/dataview.cpp:5013
    #6 0x7fc5458e5a0e in wxDataViewCtrlBase::ExpandAncestors(wxDataViewItem const&) src/common/datavcmn.cpp:1297
    #7 0x7fc5453bce08 in wxDataViewCtrl::SetSelections(wxDataViewItemArray const&) src/gtk/dataview.cpp:5228
    #8 0x5557834c5745 in test controls/dataviewctrltest.cpp:178
    #9 0x5557834d688c in invoke ../3rdparty/catch/include/internal/catch_test_registry.hpp:25
    #10 0x5557831434ef in Catch::TestCase::invoke() const ../3rdparty/catch/include/internal/catch_test_case_info.hpp:176
    #11 0x55578317f10f in Catch::RunContext::invokeActiveTestCase() (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1bc10f)
    #12 0x55578317e9dd in Catch::RunContext::runCurrentTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1bb9dd)
    #13 0x55578317b5cc in Catch::RunContext::runTest(Catch::TestCase const&) (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1b85cc)
    #14 0x55578313c64a in Catch::runTests(Catch::Ptr<Catch::Config> const&) ../3rdparty/catch/include/internal/../catch_session.hpp:82
    wxWidgets#15 0x555783180e05 in Catch::Session::runInternal() (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1bde05)
    wxWidgets#16 0x555783180931 in Catch::Session::run() (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1bd931)
    wxWidgets#17 0x555783180899 in Catch::Session::run(int, char const* const*) (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1bd899)
    wxWidgets#18 0x55578315719a in TestApp::RunTests() test.cpp:635
    wxWidgets#19 0x5557831a63c7 in TestApp::OnIdle(wxIdleEvent&) (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1e33c7)
    wxWidgets#20 0x7fc5446bbbfe in wxAppConsoleBase::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const src/common/appbase.cpp:654
    wxWidgets#21 0x7fc5446bbdba in wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const src/common/appbase.cpp:666
    wxWidgets#22 0x7fc5449b29dd in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) src/common/event.cpp:1416
    wxWidgets#23 0x7fc5449b47f4 in wxEvtHandler::SearchDynamicEventTable(wxEvent&) src/common/event.cpp:1888
    wxWidgets#24 0x7fc5449b32be in wxEvtHandler::TryHereOnly(wxEvent&) src/common/event.cpp:1609
    wxWidgets#25 0x7fc5449b70a7 in wxEvtHandler::TryBeforeAndHere(wxEvent&) include/wx/event.h:3949
    wxWidgets#26 0x7fc5449b2f72 in wxEvtHandler::ProcessEventLocally(wxEvent&) src/common/event.cpp:1546
    wxWidgets#27 0x7fc5449b2ec5 in wxEvtHandler::ProcessEvent(wxEvent&) src/common/event.cpp:1519
    wxWidgets#28 0x555783156ef7 in TestApp::ProcessEvent(wxEvent&) test.cpp:615
    wxWidgets#29 0x7fc5446badef in wxAppConsoleBase::ProcessIdle() src/common/appbase.cpp:431

but only if another wxDataViewCtrl test runs after it, i.e. there is no
leak when running just this test on its own.

This doesn't seem to make sense, as wxDataViewCtrl, and hence
GtkTreeView, is destroyed at the end of the test and it shouldn't be
possible for a test running later to affect the presence or absence of a
memory leak in it, so it might be a LeakSanitizer bug, but this doesn't
help actually getting rid of it.

The only other possibility would be to suppress this leak, but this
doesn't seem ideal, as we could suppress some other real leak too, so
for now just skip this test when using ASAN.
vadz added a commit to vadz/wxWidgets that referenced this pull request Jan 31, 2021
This makes things much, much slower, but unfortunately seems to be the
only way to avoid memory leak reports when running the tests as without
it the suppression is not used because the stack is truncated, i.e. we
only see

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f0968253bc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
    #1 0x7f09675aacb8 in g_malloc ../../../glib/gmem.c:102

in the output when the actual stack, seen with fast_unwind_on_malloc=0, is

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f12b913bbc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
    #1 0x7f12b8496cd8 in g_malloc ../../../glib/gmem.c:102
    #2 0x7f12b84b0f93 in g_strdup ../../../glib/gstrfuncs.c:363
    #3 0x7f12b49adb2a in atk_bridge_adaptor_init ../atk-adaptor/bridge.c:1039
    #4 0x7f12b566d753 in _gtk_accessibility_init ../../../../gtk/a11y/gtkaccessibility.c:992
    #5 0x7f12b5821cfc in default_display_notify_cb ../../../../gtk/gtkmain.c:714
    #6 0x7f12b5589801 in g_closure_invoke ../../../gobject/gclosure.c:810
    #7 0x7f12b559d813 in signal_emit_unlocked_R ../../../gobject/gsignal.c:3742
    #8 0x7f12b55a8b9d in g_signal_emit_valist ../../../gobject/gsignal.c:3498
    #9 0x7f12b55a90d2 in g_signal_emit ../../../gobject/gsignal.c:3554
    #10 0x7f12b558e283 in g_object_dispatch_properties_changed ../../../gobject/gobject.c:1206
    #11 0x7f12b55906f1 in g_object_notify_by_spec_internal ../../../gobject/gobject.c:1299
    #12 0x7f12b55906f1 in g_object_notify ../../../gobject/gobject.c:1347
    #13 0x7f12b5dbf54f in _gdk_display_manager_add_display ../../../../gdk/gdkdisplaymanager.c:479
    #14 0x7f12b5589a55 in _g_closure_invoke_va ../../../gobject/gclosure.c:873
    wxWidgets#15 0x7f12b55a8b27 in g_signal_emit_valist ../../../gobject/gsignal.c:3407
    wxWidgets#16 0x7f12b55a9b7b in g_signal_emit_by_name ../../../gobject/gsignal.c:3594
    wxWidgets#17 0x7f12b5ded21a in _gdk_x11_display_open ../../../../../gdk/x11/gdkdisplay-x11.c:1803
    wxWidgets#18 0x7f12b5dbf377 in gdk_display_manager_open_display ../../../../gdk/gdkdisplaymanager.c:462
    wxWidgets#19 0x7f12b5822f6a in gtk_init_check ../../../../gtk/gtkmain.c:1109
    wxWidgets#20 0x7f12b5822f6a in gtk_init_check ../../../../gtk/gtkmain.c:1101
    wxWidgets#21 0x7f12b6fd1dad in wxApp::Initialize(int&, wchar_t**)
    ...
vadz added a commit to vadz/wxWidgets that referenced this pull request Jan 31, 2021
Somehow ASAN reports a memory leak in this test:

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7fc54732ebc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
    #1 0x7fc546685cb8 in g_malloc ../../../glib/gmem.c:102
    #2 0x7fc543a49b41 in _gtk_rbtree_new ../../../../gtk/gtkrbtree.c:333
    #3 0x7fc543b0831a in gtk_tree_view_real_expand_row ../../../../gtk/gtktreeview.c:12922
    #4 0x7fc543b1087a in gtk_tree_view_expand_row ../../../../gtk/gtktreeview.c:12983
    #5 0x7fc5453ba344 in wxDataViewCtrl::DoExpand(wxDataViewItem const&, bool) src/gtk/dataview.cpp:5013
    #6 0x7fc5458e5a0e in wxDataViewCtrlBase::ExpandAncestors(wxDataViewItem const&) src/common/datavcmn.cpp:1297
    #7 0x7fc5453bce08 in wxDataViewCtrl::SetSelections(wxDataViewItemArray const&) src/gtk/dataview.cpp:5228
    #8 0x5557834c5745 in test controls/dataviewctrltest.cpp:178
    #9 0x5557834d688c in invoke ../3rdparty/catch/include/internal/catch_test_registry.hpp:25
    #10 0x5557831434ef in Catch::TestCase::invoke() const ../3rdparty/catch/include/internal/catch_test_case_info.hpp:176
    #11 0x55578317f10f in Catch::RunContext::invokeActiveTestCase() (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1bc10f)
    #12 0x55578317e9dd in Catch::RunContext::runCurrentTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1bb9dd)
    #13 0x55578317b5cc in Catch::RunContext::runTest(Catch::TestCase const&) (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1b85cc)
    #14 0x55578313c64a in Catch::runTests(Catch::Ptr<Catch::Config> const&) ../3rdparty/catch/include/internal/../catch_session.hpp:82
    wxWidgets#15 0x555783180e05 in Catch::Session::runInternal() (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1bde05)
    wxWidgets#16 0x555783180931 in Catch::Session::run() (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1bd931)
    wxWidgets#17 0x555783180899 in Catch::Session::run(int, char const* const*) (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1bd899)
    wxWidgets#18 0x55578315719a in TestApp::RunTests() test.cpp:635
    wxWidgets#19 0x5557831a63c7 in TestApp::OnIdle(wxIdleEvent&) (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1e33c7)
    wxWidgets#20 0x7fc5446bbbfe in wxAppConsoleBase::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const src/common/appbase.cpp:654
    wxWidgets#21 0x7fc5446bbdba in wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const src/common/appbase.cpp:666
    wxWidgets#22 0x7fc5449b29dd in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) src/common/event.cpp:1416
    wxWidgets#23 0x7fc5449b47f4 in wxEvtHandler::SearchDynamicEventTable(wxEvent&) src/common/event.cpp:1888
    wxWidgets#24 0x7fc5449b32be in wxEvtHandler::TryHereOnly(wxEvent&) src/common/event.cpp:1609
    wxWidgets#25 0x7fc5449b70a7 in wxEvtHandler::TryBeforeAndHere(wxEvent&) include/wx/event.h:3949
    wxWidgets#26 0x7fc5449b2f72 in wxEvtHandler::ProcessEventLocally(wxEvent&) src/common/event.cpp:1546
    wxWidgets#27 0x7fc5449b2ec5 in wxEvtHandler::ProcessEvent(wxEvent&) src/common/event.cpp:1519
    wxWidgets#28 0x555783156ef7 in TestApp::ProcessEvent(wxEvent&) test.cpp:615
    wxWidgets#29 0x7fc5446badef in wxAppConsoleBase::ProcessIdle() src/common/appbase.cpp:431

but only if another wxDataViewCtrl test runs after it, i.e. there is no
leak when running just this test on its own.

This doesn't seem to make sense, as wxDataViewCtrl, and hence
GtkTreeView, is destroyed at the end of the test and it shouldn't be
possible for a test running later to affect the presence or absence of a
memory leak in it, so it might be a LeakSanitizer bug, but this doesn't
help actually getting rid of it.

The only other possibility would be to suppress this leak, but this
doesn't seem ideal, as we could suppress some other real leak too, so
for now just skip this test when using ASAN.
vadz added a commit to vadz/wxWidgets that referenced this pull request Jan 11, 2022
This seems to result in a false positive in BitmapComboBoxTestCase with
the following stack:

ERROR: AddressSanitizer: container-overflow on address 0x00010d5331c0 at pc 0x00010743e1e8 bp 0x00016b6f8940 sp 0x00016b6f8938
WRITE of size 8 at 0x00010d5331c0 thread T0
    #0 0x10743e1e4 in wxString::ConvertedBuffer<char>::ConvertedBuffer() string.h:3598
    #1 0x10743ddbc in wxString::ConvertedBuffer<char>::ConvertedBuffer() string.h:3598
    #2 0x10743f49c in wxString::wxString(wxString const&) string.h:1157
    #3 0x1074324ac in wxString::wxString(wxString const&) string.h:1157
    #4 0x10747a4c4 in void std::__1::allocator<wxString>::construct<wxString, wxString const&>(wxString*, wxString const&) memory:916
    #5 0x10747a3f8 in void std::__1::allocator_traits<std::__1::allocator<wxString> >::construct<wxString, wxString const&, void>(std::__1::allocator<wxString>&, wxString*, wxString const&) allocator_traits.h:288
    #6 0x107479e2c in std::__1::vector<wxString, std::__1::allocator<wxString> >::__construct_at_end(unsigned long, wxString const&) vector:1063
    #7 0x107479b3c in std::__1::vector<wxString, std::__1::allocator<wxString> >::insert(std::__1::__wrap_iter<wxString const*>, unsigned long, wxString const&) vector:1889
    #8 0x10756085c in wxBaseArray<wxString, wxSortedArray_SortFunction<wxString> >::Insert(wxString, unsigned long, unsigned long) dynarray.h:181
    #9 0x108028fbc in wxVListBoxComboPopup::Insert(wxString const&, int) odcombo.cpp:539
    #10 0x108030180 in wxOwnerDrawnComboBox::DoInsertItems(wxArrayStringsAdapter const&, unsigned int, void**, wxClientDataType) odcombo.cpp:1122
    #11 0x10826d690 in wxBitmapComboBox::DoInsertItems(wxArrayStringsAdapter const&, unsigned int, void**, wxClientDataType) bmpcboxg.cpp:169
    #12 0x10485271c in wxItemContainer::InsertItems(wxArrayStringsAdapter const&, unsigned int, void**, wxClientDataType) ctrlsub.h:160
    #13 0x1048522a0 in wxItemContainer::InsertItems(wxArrayStringsAdapter const&, unsigned int) ctrlsub.h:165
    #14 0x10483c08c in wxItemContainer::Insert(wxArrayString const&, unsigned int) ctrlsub.h:247
    wxWidgets#15 0x10483dac8 in ItemContainerTestCase::Count() itemcontainertest.cpp:96
    wxWidgets#16 0x104866e04 in BitmapComboBoxTestCase::runTest() bitmapcomboboxtest.cpp:50
    ...

0x00010d5331c0 is located 64 bytes inside of 160-byte region [0x00010d533180,0x00010d533220)
allocated by thread T0 here:
    #0 0x105546714 in wrap__Znwm+0x74 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x4a714)
    #1 0x10747ae10 in void* std::__1::__libcpp_operator_new<unsigned long>(unsigned long) new:235
    #2 0x10747ad6c in std::__1::__libcpp_allocate(unsigned long, unsigned long) new:261
    #3 0x10747ace8 in std::__1::allocator<wxString>::allocate(unsigned long) memory:870
    #4 0x10747ab88 in std::__1::allocator_traits<std::__1::allocator<wxString> >::allocate(std::__1::allocator<wxString>&, unsigned long) allocator_traits.h:260
    #5 0x10747aac4 in std::__1::__split_buffer<wxString, std::__1::allocator<wxString>&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<wxString>&) __split_buffer:314
    #6 0x10747a110 in std::__1::__split_buffer<wxString, std::__1::allocator<wxString>&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<wxString>&) __split_buffer:313
    #7 0x107479c30 in std::__1::vector<wxString, std::__1::allocator<wxString> >::insert(std::__1::__wrap_iter<wxString const*>, unsigned long, wxString const&) vector:1904
    #8 0x10756085c in wxBaseArray<wxString, wxSortedArray_SortFunction<wxString> >::Insert(wxString, unsigned long, unsigned long) dynarray.h:181
    #9 0x108028fbc in wxVListBoxComboPopup::Insert(wxString const&, int) odcombo.cpp:539
    #10 0x108030180 in wxOwnerDrawnComboBox::DoInsertItems(wxArrayStringsAdapter const&, unsigned int, void**, wxClientDataType) odcombo.cpp:1122
    #11 0x10826d690 in wxBitmapComboBox::DoInsertItems(wxArrayStringsAdapter const&, unsigned int, void**, wxClientDataType) bmpcboxg.cpp:169
    #12 0x1075590bc in wxItemContainer::DoAppendItems(wxArrayStringsAdapter const&, void**, wxClientDataType) ctrlsub.h:352
    #13 0x10484c9e0 in wxItemContainer::AppendItems(wxArrayStringsAdapter const&, void**, wxClientDataType) ctrlsub.h:117
    #14 0x10484c8d4 in wxItemContainer::AppendItems(wxArrayStringsAdapter const&) ctrlsub.h:122
    wxWidgets#15 0x10483999c in wxItemContainer::Append(wxArrayString const&) ctrlsub.h:209
    wxWidgets#16 0x10483ccfc in ItemContainerTestCase::Count() itemcontainertest.cpp:82
    wxWidgets#17 0x104866e04 in BitmapComboBoxTestCase::runTest() bitmapcomboboxtest.cpp:50
    ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants