Hot Door CORE Forum
Mac crash on quit with CORE 0.8.1 - Printable Version

+- Hot Door CORE Forum (http://hotdoorcore.com/forum)
+-- Forum: All forums (http://hotdoorcore.com/forum/forumdisplay.php?fid=1)
+--- Forum: General discussion (http://hotdoorcore.com/forum/forumdisplay.php?fid=3)
+--- Thread: Mac crash on quit with CORE 0.8.1 (/showthread.php?tid=329)



Mac crash on quit with CORE 0.8.1 - Rick Johnson - 11-27-2022

I'm finding an issue with plugins compiled with CORE 0.8.1 that seems to affect only Mac plugins, and only ones with flyout menus. It's not limited to AI 27, and only happens about a third of the time, just after ~Plugin(). I'll summarize the crash report.

PHP Code:
Exception TypeEXC_BAD_ACCESS (SIGSEGV)
Exception CodesEXC_I386_GPFLT
Exception Note
EXC_CORPSE_NOTIFY
Termination Signal
Segmentation fault11
Termination Reason
: Namespace SIGNALCode 0xb
Terminating Process
exc handler [28001]

Thread 0 Crashed:: Dispatch queuecom.apple.main-thread
0 libc
++abi.dylib 0x00007fff204ceba7 __dynamic_cast 26
1 com
.rj-graffix.plugin.grodyplugin0x000000018dc08ca4 hdi::core::Flyout::~Flyout() + 212 

I can't destroy flyouts at shutdown as with regular menus, so I tried clearing the entries, and that doesn't help. Panels are destroyed.

Here's how I define my flyout menus.

Code:
this->xFlyoutMenu.pushEntry( hdi::core::PopupEntry(
"showTTS",
 "Show settings",
 NULL,
 true
 ));

this->xFlyoutMenu.pushEntry( hdi::core::PopupEntry(
 "apply2projection",
 "Apply to Projection panel",
 NULL,
 true
 ));

this->xFlyoutMenu.setSelectionMadeCallback (HDI_CORE_CALLBACK(axo::Plugin, this, __xFlyoutMenuCB));
this->__xformPanel.setFlyoutMenu(this->xFlyoutMenu);

What's puzzling is that these crashes don't happen in Windows, and didn't happen prior to CORE 0.8.1. I'm using Xcode 10.3 and Xcode 12.4 with macOS 11.7.1 Big Sur. Any suggestions for narrowing the bug down would be much appreciated.


RE: Mac crash on quit with CORE 0.8.1 - Rick Johnson - 11-29-2022

I took the current code and ported it back to CORE 0.8.0 (changed entry and keypress) and compiled for Mac 2020: no crashing at all, where 0.8.1 projects almost always crashed.


I'll try to build a project with the Skeleton sample that demonstrates this.


RE: Mac crash on quit with CORE 0.8.1 - Rick Johnson - 08-09-2023

I believe I solved the problem: Don't declare a flyout menu as a class member. Instead, declare it locally and if you need to enable/disable an item or change an item's text, access it through its panel.

Code:
std::vector< std::shared_ptr<hdi::core::PopupEntry>> flyoutEntriesV = *this->__drawSettingsPanel.flyoutMenu()->entries();
flyoutEntriesV[3]->setEnabled(HDI_CORE_ILLUSTRATOR->documentCount() > 0);
I couldn't make a demo with the Skeleton project because it doesn't always happen. It seems to go haywire with larger projects with many things going on, so perhaps it conflicts with something else. But it's great that this workaround solved the crash-on-quit problem!