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

GrandOrgue crashes under OSx when the midi event dialog is open #966

Closed
oleg68 opened this issue Jan 16, 2022 · 2 comments · Fixed by #971
Closed

GrandOrgue crashes under OSx when the midi event dialog is open #966

oleg68 opened this issue Jan 16, 2022 · 2 comments · Fixed by #971
Assignees
Labels
bug Something isn't working
Milestone

Comments

@oleg68
Copy link
Contributor

oleg68 commented Jan 16, 2022

It's a know issue, I've seen it before but I can't find it. It has something to do with an automatically released wxDialog. I don't know where to find the crash report but I tried to debug and this is what I get:

`GrandOrgue(785,0x10043bdc0)` malloc: *** error for object 0x7ffeefbfbbb8: pointer being freed was not allocated
GrandOrgue(785,0x10043bdc0) malloc: *** set a breakpoint in malloc_error_break to debug
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00007fff72e4633a libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00000001015719bc libsystem_pthread.dylib`pthread_kill + 430
    frame #2: 0x00007fff72dcd808 libsystem_c.dylib`abort + 120
    frame #3: 0x00007fff72ec750b libsystem_malloc.dylib`malloc_vreport + 548
    frame #4: 0x00007fff72eca40f libsystem_malloc.dylib`malloc_report + 151
    frame #5: 0x000000010014397c GrandOrgue`MIDIEventDialog::~MIDIEventDialog() + 44
    frame #6: 0x0000000100f9d052 libwx_baseu-3.1.dylib`wxAppConsoleBase::DeletePendingObjects() + 74
    frame #7: 0x0000000100f9d50c libwx_baseu-3.1.dylib`wxAppConsoleBase::ProcessIdle() + 82
    frame #8: 0x0000000100a8649e libwx_osx_cocoau_core-3.1.dylib`wxAppBase::ProcessIdle() + 22
    frame #9: 0x00000001009f18e8 libwx_osx_cocoau_core-3.1.dylib`wxApp::ProcessIdle() + 26
    frame #10: 0x00000001010624ff libwx_baseu-3.1.dylib`wxCFEventLoop::CommonModeObserverCallBack(__CFRunLoopObserver*, int) + 75
    frame #11: 0x00007fff38eab7bc CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    frame #12: 0x00007fff38eab6ec CoreFoundation`__CFRunLoopDoObservers + 457
    frame #13: 0x00007fff38eaadab CoreFoundation`__CFRunLoopRun + 1179
    frame #14: 0x00007fff38eaa2b3 CoreFoundation`CFRunLoopRunSpecific + 466
    frame #15: 0x00007fff3b56bc38 Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
    frame #16: 0x0000000100a4890f libwx_osx_cocoau_core-3.1.dylib`wxGUIEventLoop::DoDispatchTimeout(unsigned long) + 189
    frame #17: 0x00000001010628b7 libwx_baseu-3.1.dylib`wxCFEventLoop::DispatchTimeout(unsigned long) + 35
    frame #18: 0x00000001010629c8 libwx_baseu-3.1.dylib`wxCFEventLoop::OSXDoRun() + 92
    frame #19: 0x0000000100a48e24 libwx_osx_cocoau_core-3.1.dylib`wxModalEventLoop::OSXDoRun() + 110
    frame #20: 0x0000000101062a15 libwx_baseu-3.1.dylib`wxCFEventLoop::DoRun() + 29
    frame #21: 0x0000000100fc73f1 libwx_baseu-3.1.dylib`wxEventLoopBase::Run() + 161
    frame #22: 0x00000001009ba535 libwx_osx_cocoau_core-3.1.dylib`wxDialog::ShowModal() + 101
    frame #23: 0x000000010018df86 GrandOrgue`SettingsMidiMessage::OnEventsDoubleClick(wxListEvent&) + 822
    frame #24: 0x000000010018e6f4 GrandOrgue`SettingsMidiMessage::OnProperties(wxCommandEvent&) + 420`

This doesn't look ok, how do I post a backtrace?

Originally posted by @willeke1234 in #960 (reply in thread)

@oleg68
Copy link
Contributor Author

oleg68 commented Jan 16, 2022

@willeke1234 could you describe ste-by-step, how to reproduce this crash?

@oleg68 oleg68 added the bug Something isn't working label Jan 16, 2022
@oleg68 oleg68 self-assigned this Jan 16, 2022
@oleg68 oleg68 added this to the 3.6.1 milestone Jan 16, 2022
@willeke1234
Copy link
Contributor

Steps to reproduce:

  1. Choose Settings…
  2. Go to the Organs or Initial MIDI Configuration tab
  3. Open MIDI Settings dialog
  4. Click on Cancel or OK

The MIDI Settings dialog always crashes when opened from the Settings window and never crashes anywhere else. I'm not familiar with C++/wxWidgets but I think the crash is caused by:

MIDIEventDialog::OnOK and MIDIEventDialog::OnCancel call Destroy.

GOrgueDocument::ShowMIDIEventDialog allocates the dialog on the heap and calls registerWindow.

SettingsOrgan and SettingsMidiMessage allocate the dialog on the stack and call ShowModal. If a dialog is allocated on the stack then Destroy shouldn't be called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants