[wxMac] crash with drag and drop

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
tessman
Earned some good credits
Earned some good credits
Posts: 107
Joined: Tue Oct 06, 2009 5:25 pm

[wxMac] crash with drag and drop

Post by tessman » Mon Feb 01, 2021 2:50 pm

I get a consistent crash with drag and drop, I believe since it was refactored into dnd.mm. The second time I attempt to drag and drop with a wxDataObjectComposite with a custom wxDataObjectSimple component, I get a crash shortly afterward in what looks like automatic NSPasteBoard cleanup:

Code: Select all

Application Specific Information:
Detected over-release of a CFTypeRef 0x7fc988c10600 (7 / CFString)

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.CoreFoundation      	0x00007fff2059a00b _CFRelease.cold.3 + 73
1   com.apple.CoreFoundation      	0x00007fff20534128 _CFRelease + 1322
2   com.apple.CoreFoundation      	0x00007fff20446ce8 __RELEASE_OBJECTS_IN_THE_SET__ + 132
3   com.apple.CoreFoundation      	0x00007fff20446c1f -[__NSSetM dealloc] + 128
4   com.apple.AppKit              	0x00007fff22fceaa0 -[_NSPasteboardTypeCache dealloc] + 35
5   libobjc.A.dylib               	0x00007fff2022d39d AutoreleasePoolPage::releaseUntil(objc_object**) + 167
6   libobjc.A.dylib               	0x00007fff2021033e objc_autoreleasePoolPop + 161
7   com.apple.CoreFoundation      	0x00007fff2042a1f0 _CFAutoreleasePoolPop + 22
8   com.apple.Foundation          	0x00007fff211c8e01 -[NSAutoreleasePool drain] + 129
9   com.apple.AppKit              	0x00007fff22c75b3c -[NSApplication run] + 636
10  dnd                           	0x000000010350fd2b wxGUIEventLoop::OSXDoRun() + 171 (evtloop.mm:304)
11  dnd                           	0x0000000103408ca7 wxCFEventLoop::DoRun() + 39 (evtloop_cf.cpp:331)
12  dnd                           	0x000000010334af8b wxEventLoopBase::Run() + 235 (evtloopcmn.cpp:90)
13  dnd                           	0x000000010330cc0f wxAppConsoleBase::MainLoop() + 191 (appbase.cpp:380)
14  dnd                           	0x000000010330c6cc wxAppConsoleBase::OnRun() + 28 (appbase.cpp:301)
15  dnd                           	0x0000000103554e6b wxAppBase::OnRun() + 59 (appcmn.cpp:335)
16  dnd                           	0x00000001034a9289 wxApp::OnRun() + 41 (app.cpp:364)
17  dnd                           	0x0000000103382f9f wxEntry(int&, wchar_t**) + 287 (init.cpp:507)
18  dnd                           	0x000000010338315b wxEntry(int&, char**) + 59 (init.cpp:519)
19  dnd                           	0x00000001032e3623 main + 35 (dnd.cpp:116)
20  libdyld.dylib                 	0x00007fff2038c621 start + 1
Has anyone else seen anything like this? This is something that's previously worked for me for years but began crashing when I updated wxMac to the version using the newer NSPasteBoard code, but it's also possible I've been doing something obviously knuckleheaded all this time.

I've managed to replicate this in the dnd sample with the attached. All you have to do is start a drag twice off the "Drag text from here!" panel — you don't even have to complete the drag; you can let it drop right back on "Drag text from here!" if you want, or anywhere else.

Note that if you replace the (minimal) custom data object with something like a wxHTMLDataObject, it doesn't crash.

Edit: I revised the attached sample to remove as much customization to the custom data object as possible, and to make it easily switchable between the crashing custom data object and a working wxHTMLDataObject.
Attachments
dnd_crash.cpp
(57.05 KiB) Downloaded 39 times
Last edited by tessman on Mon Feb 01, 2021 4:56 pm, edited 1 time in total.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 5154
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: [wxMac] crash with drag and drop

Post by ONEEYEMAN » Mon Feb 01, 2021 4:28 pm

Hi,
The usual stanza:

1. wx version.
2. OSX version?
3. How did you configure wx?

Thank you.

tessman
Earned some good credits
Earned some good credits
Posts: 107
Joined: Tue Oct 06, 2009 5:25 pm

Re: [wxMac] crash with drag and drop

Post by tessman » Mon Feb 01, 2021 5:00 pm

wx 3.1.5 pulled today, although it's been doing this for a while in development.

macOS 11.1 (Big Sur), although it also does this with wx 3.1.5 on older macOS such as 10.14 (Mojave).

CC=clang CXX=clang++ CXXFLAGS="-stdlib=libc++" CPPFLAGS="-stdlib=libc++" LIBS="-lc++" --with-macosx-version-min=10.10 --with-libjpeg=builtin --with-libpng=builtin --with-libtiff=builtin --with-expat=builtin --with-zlib=builtin --with-liblzma=no --disable-compat30 --disable-shared --enable-monolithic --enable-debug

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 5154
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: [wxMac] crash with drag and drop

Post by ONEEYEMAN » Mon Feb 01, 2021 5:46 pm

Hi,
Coouple of notes:

Code: Select all

CC=clang CXX=clang++ CXXFLAGS="-stdlib=libc++" CPPFLAGS="-stdlib=libc++" LIBS="-lc++" --with-macosx-version-min=10.10 --with-libjpeg=builtin --with-libpng=builtin --with-libtiff=builtin --with-expat=builtin --with-zlib=builtin --with-liblzma=no --disable-compat30 --disable-shared --enable-monolithic --enable-debug
1. clang compiler is the default one OSX since forever. You don't have to choose it explicitly.
2. Selecting libc++ doesn't make much sense if you are not using std=c++11 {+}.
3. "--enable-monolithic" on OSX doesn't give you any advantage over the multilib one. I'd drop it altogether.
4. "--disable-shared" on *nix-like platform? Why?

So, given this - can you reproduce it with the simple:

Code: Select all

../configure --enable-debug --with-cocoa
I believe this is how the automatic builds of wx is done.

Thank you.

tessman
Earned some good credits
Earned some good credits
Posts: 107
Joined: Tue Oct 06, 2009 5:25 pm

Re: [wxMac] crash with drag and drop

Post by tessman » Mon Feb 01, 2021 7:54 pm

Yes, some of those flags are vestigial and/or as we're going between different versions.

Rebuilding without customizations doesn't seem to have any effect, i.e., the same thing happens.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 5154
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: [wxMac] crash with drag and drop

Post by ONEEYEMAN » Mon Feb 01, 2021 8:13 pm

Hi,
You can try and send e-mail to wx-users ML.
This forum is for the users by users - wx developers are not coming here.

Thank you.

tessman
Earned some good credits
Earned some good credits
Posts: 107
Joined: Tue Oct 06, 2009 5:25 pm

Re: [wxMac] crash with drag and drop

Post by tessman » Mon Feb 01, 2021 9:11 pm

Yeah, thanks, that was going to be my next step. I just wanted to see first if this was something anyone else had run into and/or could replicate.

tessman
Earned some good credits
Earned some good credits
Posts: 107
Joined: Tue Oct 06, 2009 5:25 pm

Re: [wxMac] crash with drag and drop

Post by tessman » Tue Feb 02, 2021 4:43 pm

Just to close this off, in case anyone else runs into it: this shouldn't be a problem with the latest wx master. I'd thought I'd pulled the latest but somehow managed not to.

Post Reply