Below Error Happened from time to time.
frame #0: 0x000000000bad4007
error: memory read failed for 0xbad4000
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xbad4007)
* frame #0: 0x000000000bad4007
frame #1: 0x00007ff821b71d6f ImageIO`PNGReadPlugin::InitializePluginData(IIOImageReadSession*, IIODictionary*, IIODictionary*, CGImageMetadata*, CGColorSpace**, ReadPluginData&, PNGPluginData&, __CFDictionary*) + 917
frame #2: 0x00007ff821b719d2 ImageIO`PNGReadPlugin::initialize(IIODictionary*) + 62
frame #3: 0x00007ff821b692e9 ImageIO`IIOReadPlugin::callInitialize() + 113
frame #4: 0x00007ff821b68fad ImageIO`IIO_Reader::initImageAtOffset(CGImagePlugin*, unsigned long, unsigned long, unsigned long) + 79
frame #5: 0x00007ff821b6688b ImageIO`IIOImageSource::makeImagePlus(unsigned long, IIODictionary*) + 715
frame #6: 0x00007ff821b7357f ImageIO`IIOImageSource::createImageAtIndex(unsigned long, IIODictionary*) + 57
frame #7: 0x00007ff821b73473 ImageIO`CGImageSourceCreateImageAtIndex + 268
frame #8: 0x00007ff81d568188 HIServices`setCursorFromBundle + 1819
frame #9: 0x00007ff81d5673df HIServices`CoreCursorSetAndReturnSeed + 170
frame #10: 0x00007ff81aff8dfd AppKit`-[NSCursor _reallySet] + 678
frame #11: 0x00007ff81b000d48 AppKit`+[NSCursor _setOverrideCursor:type:] + 296
frame #12: 0x00007ff81b0003ac AppKit`-[NSWindow(NSWindowResizing) _edgeResizingCursorUpdate:atLocation:] + 281
frame #13: 0x00007ff81b04fadb AppKit`-[NSThemeFrame mouseEntered:] + 65
frame #14: 0x00007ff81b04fa30 AppKit`-[NSTrackingArea _dispatchMouseEntered:] + 146
frame #15: 0x00007ff81b5172d2 AppKit`-[_NSTrackingAreaAKManager _updateActiveTrackingAreasForWindowLocation:modifierFlags:] + 6776
frame #16: 0x00007ff81b518707 AppKit`-[_NSTrackingAreaAKManager mouseMoved:] + 463
frame #17: 0x00007ff81b82cb5a AppKit`_routeMouseMovedEvent + 281
frame #18: 0x00007ff81afccd33 AppKit`-[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 472
frame #19: 0x00007ff81afcc93f AppKit`-[NSWindow(NSEventRouting) sendEvent:] + 345
frame #20: 0x00000001002c2002 crossbow`-[wxNSWindow sendEvent:](self=0x00000001043197c0, _cmd="sendEvent:", event=0x00006000037312c0) at nonownedwnd.mm:177:9
frame #21: 0x00007ff81b633d02 AppKit`routeMouseMovedEvent + 140
frame #22: 0x00007ff81afcb808 AppKit`-[NSApplication(NSEvent) sendEvent:] + 1608
frame #23: 0x00000001001d6851 crossbow`-[wxNSApplication sendEvent:](self=0x0000000104305b20, _cmd="sendEvent:", anEvent=0x00006000037312c0) at utils.mm:359:9
frame #24: 0x00007ff81b285bbe AppKit`-[NSApplication _handleEvent:] + 65
frame #25: 0x00007ff81ae5acdd AppKit`-[NSApplication run] + 623
frame #26: 0x00000001002b04f4 crossbow`wxGUIEventLoop::OSXDoRun(this=0x0000600002640b40) at evtloop.mm:301:13
frame #27: 0x0000000100119b84 crossbow`wxCFEventLoop::DoRun(this=0x0000600002640b40) at evtloop_cf.cpp:326:13
frame #28: 0x0000000100056221 crossbow`wxEventLoopBase::Run(this=0x0000600002640b40) at evtloopcmn.cpp:87:12
frame #29: 0x000000010000da4a crossbow`wxAppConsoleBase::MainLoop(this=0x00000001043041c0) at appbase.cpp:363:37
frame #30: 0x000000010000d589 crossbow`wxAppConsoleBase::OnRun(this=0x00000001043041c0) at appbase.cpp:281:12
frame #31: 0x000000010030eeb8 crossbow`wxAppBase::OnRun(this=0x00000001043041c0) at appcmn.cpp:334:26
frame #32: 0x000000010023b676 crossbow`wxApp::OnRun(this=0x00000001043041c0) at app.cpp:356:23
frame #33: 0x000000010009127d crossbow`wxEntry(argc=0x00000001009b569c, argv=0x00006000000041c0) at init.cpp:473:26
frame #34: 0x0000000100091426 crossbow`wxEntry(argc=0x00007ff7bfeff588, argv=0x00007ff7bfeff840) at init.cpp:483:12
frame #35: 0x0000000100762ed3 crossbow`main(argc=1, argv=0x00007ff7bfeff840) at main.cpp:4:1
frame #36: 0x00007ff8179a341f dyld`start + 1903
(lldb)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@markyang59 ,
Do you have a PNG that produces it?
And a simple code that can be run to see the crash?
Thank you.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Here is the only part uses PNG files
toolbar->AddTool(ID_TOOL_CONNECT , wxT("CONNECT") , wxBitmapPNG(L"/img/connect_b.png"));
toolbar->AddTool(ID_TOOL_DISCONNECT , wxT("DISCONNECT") , wxBitmapPNG(L"/img/disconnect_b.png"));
toolbar->AddSeparator();
toolbar->AddSpacer(10);
toolbar->AddTool(ID_TOOL_SEND , wxT("SEND") , wxBitmapPNG(L"/img/send_b.png"));
toolbar->AddSpacer(10);
toolbar->AddTool(ID_TOOL_RECV , wxT("RECV") , wxBitmapPNG(L"/img/recv_b.png"));
toolbar->AddSpacer(10);
toolbar->AddTool(ID_TOOL_STOP , wxT("STOP") , wxBitmapPNG(L"/img/stop_b.png"));
toolbar->AddSpacer(5);
toolbar->AddTool(ID_TOOL_DELETE , wxT("DELETE") , wxBitmapPNG(L"/img/delete_b.png"));
toolbar->AddSpacer(10);
toolbar->AddSeparator();
toolbar->AddSpacer(10);
toolbar->AddTool(ID_TOOL_INBOX , wxT("INBOX") , wxBitmapPNG(L"/img/inbox_b.png"));
toolbar->AddTool(ID_TOOL_OUTBOX , wxT("OUTBOX") , wxBitmapPNG(L"/img/outbox_b.png"));
toolbar->AddTool(ID_TOOL_WATCHBOX , wxT("WATCHBOX") , wxBitmapPNG(L"/img/watchbox_b.png"));
toolbar->AddSeparator();
toolbar->AddTool(ID_TOOL_SPEED_RESET , wxT("SPEED RESET") , wxBitmapPNG(L"/img/reset_b.png"));
toolbar->AddTool(ID_TOOL_SPEED_UP , wxT("SPEED UP" ) , wxBitmapPNG(L"/img/up_b.png"));
toolbar->AddTool(ID_TOOL_SPEED_DOWN , wxT("SPEED DOWN") , wxBitmapPNG(L"/img/down_b.png"));
And here is all PNG files used
https://www.dropbox.com/s/41vc75bwqlhkbst/PNG.zip
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Closed #23547 as completed.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
I found the problem.
When creating wxBitmap add a button for wxAuiToolBar.
wxBitmap object should be in the same scope as the toolbar.
If the bitmap object is deleted before toolbar creation is finished.
Memory will be corrupted.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
I found the problem. When creating wxBitmap add a button for wxAuiToolBar. wxBitmap object should be in the same scope as the toolbar. If the bitmap object is deleted before toolbar creation is finished. Memory will be corrupted.
No, this shouldn't happen. Please try reproducing the problem with a minimal patch to the aui sample and attach this patch here and reopen if you can do it.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Sorry. The same error occurred after some running time.
It's very hard to reproduce this error.
It happens from time to time and even worse. it took time to happen.
How can I catch it ?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Reopened #23547.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
The usual first step: build with ASAN and/or run under Valgrind.
Unless you can reproduce the problem in the sample, is also very likely due to some unrelated bug in your application and not wx itself.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
this sympom appered only after upgrade wx to latest version.
It seems related with Cursor change..
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Sorry, which cursor change? Also, what was the last version with which it worked and the current one, with which it doesn't? Could you be running into #23545 (which I'll try to fix soon)?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
In my posted log. The system (not my app) trying to change the cursor which seems depends on some PNG image.
and a crash happens there.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
The most suspicious part is wxAuiToolBar creation with a PNG file
toolbar = new wxAuiToolBar(this,ID_TOOL_1,wxDefaultPosition,wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE|wxAUI_TB_TEXT|wxAUI_TB_PLAIN_BACKGROUND);
toolbar->SetToolBitmapSize(wxSize(28,28));
toolbar->AddTool(ID_TOOL_CONNECT , wxT("CONNECT") , wxBitmap("img/connect_b.png",wxBITMAP_TYPE_PNG));
with the above code, the error happens after some time.
with the below alternative code. the error seems disappeared (with poor image quality)
toolbar->AddTool(ID_TOOL_CONNECT , wxT("CONNECT") , wxBitmap(xpm_connect));
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
My app was ok with wxWidget 3.1.8
and
the problem happens with the latest wxWidget 3.2.2
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
My problem seems to stem from #23514.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
My app was ok with wxWidget 3.2.1 the problem happens with the latest wxWidget 3.2.2 and My problem seems to stem from #23514.
This can't be the case because #23514 only affects master (pre-3.3.0). If you're using master, please retest when this is fixed. If you really use 3.2.2, please consider running git-bisect to find the exact commit which broke it for you, there are not that many of them between 3.2.1 and .2.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Sorry.
I got the source from git directly and compiled it (hoping to any bug fix applied)
git clone https://github.com/wxWidgets/wxWidgets.git --recurse-submodules
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Please retry with the latest master (you need to run git pull
) and check if 563cc11 in it helps.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Dear.
I downloaded it with git and compiled it.
More than 5 hours. My App runs well!
It seems your work fixed this error.
Thank you very much!
I will test my app until tomorrow and
if it runs well I will close this issue
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
This is fixed with 563cc11
Thank you!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Closed #23547 as completed.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Reopened #23547.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Error happened again :(
Still, same error message related with PNGReadPlugin
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Sorry, if it's not due to this, you will have to give us something to work with as otherwise I just have no idea.
As I said, you have several possibilities:
git bisect
to find the exact commit which broke it.I'd definitely start with (1) as this should be pretty useful in any case, but I could try to do something if you do (2) or (3).
But without any more information it's just not going to be possible to do anything about this, sorry.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
I can fix this crash with a code change
Previous with error:
toolbar->AddTool(ID_TOOL_CONNECT , wxT("CONNECT") , wxBitmap("img/connect_b.png" ,wxBITMAP_TYPE_PNG));
Error fixed with this change
bmp_connect = new wxBitmap("img/connect_b.png" ,wxBITMAP_TYPE_PNG);
toolbar->AddTool(ID_TOOL_CONNECT , wxT("CONNECT") , *bmp_connect);
Using local wxBitmap seems to cause this error.
Allocate wxBitmap in a heap. fixed this.
I hope this can be a hint for fix error.
Thank you very much..
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Closed #23547 as completed.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
No, this is definitely wrong, you're leaking a wxBitmap
here. Moreover, I'm pretty sure this doesn't fix anything and you will see the problem again in the future. You must be corrupting the heap elsewhere in your program, but I'm not a magician and can't tell you more. Why you don't use ASAN to find it out remains a mystery to me, however.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
I found this while Googling part of my stack trace, it seems to be a known problem, narrowed down to having libpng
installed to /opt/homebrew/lib
and having /opt/homebrew/lib
in env var DYLD_LIBRARY_PATH
. https://github.com/orgs/Homebrew/discussions/5420
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Thank you !
This helps a lot !
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
How can you have "libpng" installed without this crash happening ?
Why is the crash happening in the first place (having libpng installed) ?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
I guess the crash happens because of some ABI mismatch between the different libpng versions (maybe due to version mismatch).
Having libpng installed shouldn't be a problem, it's just loading it which is problematic, so don't do this.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
But I have Gtk installed and that needs "libpng" to work (else I have to change my entire icon set).
But what is the other version, that is installed. I do not have any other "libpng" installed. ?
I can't find "libpng" in the system either. So where is the mismatch ?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
I don't know, sorry. If you use this libpng for building wxWidgets, there shouldn't be any problem.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
What do you mean by "this" libpng ?
Is there a special version for wxWidgets ?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
When you build wxWidgets you can use either the libpng bundled with it or one already installed on the system. You need to do the latter if you have to use that one in your application.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Thank you for solving long lasting problem.
I have fixed this problem with
--with-libpng=sys
option when make configuration
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
So the problem is that "dotnet" links to "CoreServices" that uses "ImageIO" framework. The ImageIO framework is using a "libPng.dylib" (I assume is very old). But if another "libpng" is installed from Homebrew or any other. Then normally you would have this:
libpng16.16.dylib
libpng.dylib -> libpng16.16.dylib
libpng16.dylib -> libpng16.16.dylib
The crash is because the "libpng.dylib" symbolic link is present, then the ImageIO framework tries to load that "libpng" and it do not match the API it expected.
So the simple solution is to delete the "libpng.dylib" symbolic link.
I would think the same solution could be used here. But not sure.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Wait, where does dotnet come from here?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
The dotnet is just what caused my problem. But I wrote it here, because it could be the same solution for this bug.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
The correct solution here is to set DYLD_FALLBACK_LIBRARY_PATH
instead of DYLD_LIBRARY_PATH
, so that ImageIO loads its own libPng rather than the Homebrew one.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.