qLab / qLib

A procedural asset library for SideFX Houdini. https://www.facebook.com/qLibHoudini
http://qlab.github.io/qLib
Other
738 stars 116 forks source link

h.ql_clipboard_shruggie causes Mac OS/X to crash on startup #1439

Open cfxegbert opened 5 months ago

cfxegbert commented 5 months ago

Removing this block allows the plugin to load. https://github.com/qLab/qLib/blame/4f38e98ee9e65322f2a841868facd66511a622d5/MainMenuCommon.xml#L118-L126 My guess is there is a different XML parser on the Mac and it is decoding the UTF-8 before it is passed to decode() python function. Is this item necessary?

github will not let me fork the project right now saying the storage is down. I have cleaned up the XML (prettyfied it). Would you like me to submit a pull request?

2024-05-03 10:31:44.481 houdini[17543:14678721] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSPlaceholderString initWithUTF8String:]: NULL cString'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000191d5f0e4 __exceptionPreprocess + 176
    1   libobjc.A.dylib                     0x000000019187dfd0 objc_exception_throw + 60
    2   Foundation                          0x0000000192c2dc08 NSEqualSizes + 0
    3   libHoudiniUI.dylib                  0x0000000105c2abf0 _ZN10SI_OSXMenu12generateMenuEP11si_MenuItemS1_P6NSMenuRK24si_MenuGenerationContextP20SI_XMLMenuItemFilteri + 608
    4   libHoudiniUI.dylib                  0x0000000105c2b160 _ZN10SI_OSXMenu12generateMenuEP11si_MenuItemS1_P6NSMenuRK24si_MenuGenerationContextP20SI_XMLMenuItemFilteri + 2000
    5   libHoudiniUI.dylib                  0x0000000105c2b160 _ZN10SI_OSXMenu12generateMenuEP11si_MenuItemS1_P6NSMenuRK24si_MenuGenerationContextP20SI_XMLMenuItemFilteri + 2000
    6   libHoudiniUI.dylib                  0x0000000105c2b160 _ZN10SI_OSXMenu12generateMenuEP11si_MenuItemS1_P6NSMenuRK24si_MenuGenerationContextP20SI_XMLMenuItemFilteri + 2000
    7   libHoudiniUI.dylib                  0x0000000105bd0810 _ZN12si_ParseData15generateMenuBarERK24si_MenuGenerationContext + 216
    8   libHoudiniUI.dylib                  0x0000000105bddd14 _ZN10SI_XMLMenu25parseAndGenerateMenuBarUIER12AP_InterfacePKcS3_S3_bP20SI_XMLMenuItemFilterb + 376
    9   libHoudiniAPPS2.dylib               0x0000000107d87474 _ZN8OPUI_App16buildMainMenuBarEPKcS1_ + 104
    10  libHoudiniAPPS3.dylib               0x0000000106fedad4 _ZN8FUSE_App15initApplicationEP10UI_ManageriPPKc + 10836
    11  libHoudiniAPPS2.dylib               0x0000000107f4b128 _ZN12OPUI_MainApp15initApplicationEP10UI_ManageriPPKc + 1364
    12  libHoudiniUI.dylib                  0x0000000105bf3384 main + 6676
    13  dyld                                0x00000001918aff28 start + 2236
)
libc++abi: terminating due to uncaught exception of type NSException
johnnyquest commented 5 months ago

hi @cfxegbert could you just paste the updated code snippet here? :) ~but you could do a pull request as well if you like, whatever is easier.~ thanks for spotting this, I personally don't have OSX (and don't do much testing on windows either :))

On second thought, please paste the code here, so I could test on linux right away without trying to pull from any repo, etc. I'll also try to test it on windows! :D

cfxegbert commented 5 months ago

It seems no matter what the expression I use in houdini crashes on the Mac.

<labelExpression>'Shruggie'</labelExpression>

will crash Houdini 20

<label>Shruggie</label>

works fine.

I even tried

                                <labelExpression><![CDATA[
return 'Shruggie']]>
                                </labelExpression>

and it failed.

Maybe open an issue with SideFX on this one.

cfxegbert commented 5 months ago

After more experiments it seems labelExpressions do not work in the MainMenuCommon.xml. The main menu on the Mac is the Apple menu bar and the rest of the menus are drawn by Houdini. I will come up with a simple example and send to SideFX. For the time being could the Shruggie be removed or changed to a plain text label.

Edit: Bug submitted to SideFX.

<?xml version="1.0" encoding="UTF-8"?>
<mainMenu>
    <menuBar>
        <subMenu id="testing_menu">
            <insertBefore>help_menu</insertBefore>
            <label>Testing</label>
            <subMenu id="testing_submenu">
                <label>Test Submenu</label>
                <scriptItem id="h.test_label">
                    <label>Plain label</label>
                    <scriptCode>
                        <![CDATA[
hou.ui.displayMessage("Plain label")]]>
                    </scriptCode>
                </scriptItem>
                <scriptItem id="h.test_label_expression">
                    <labelExpression>'Expression label'</labelExpression>
                    <scriptCode>
                        <![CDATA[
hou.ui.displayMessage("Expression label")]]>
                    </scriptCode>
                </scriptItem>
                <separatorItem />
            </subMenu>
        </subMenu>
    </menuBar>
</mainMenu>
cfxegbert commented 5 months ago

The bug has been fixed on the 20.0.708 release. You should just stick with an ASCII label because the fix will not be available on older versions

johnnyquest commented 4 months ago

see also https://github.com/Aeoll/Aelib/issues/22

johnnyquest commented 3 months ago

@cfxegbert better later than never I guess, just rolled out 0.2.250, replaced shruggie menu item with something more ascii (?) friendly. Could you please test it and tell me if that's working? Thanks, much appreciated

johnnyquest commented 2 months ago

@cfxegbert did you have an opportunity to test this yet?

cfxegbert commented 3 weeks ago

Just tested. The current one in 0.2.255 does not work in houdini-19.5.x. Please change to an ASCII representation and do not use any code in a top level menu item.

johnnyquest commented 3 weeks ago

Just tested. The current one in 0.2.255 does not work in houdini-19.5.x. Please change to an ASCII representation and do not use any code in a top level menu item.

@cfxegbert could you please specify what exactly is needed to be changed to an ASCII representation? I might be misunderstanding something, but I was under the impression that it's the menu item label, and I already replaced that with ASCII characters (or maybe not ASCII by strict definition but there's no "exotic" characters in there).

Is it the single quote character causing issues? (sorry I don't have direct access to a Mac)

(update: managed to ask someone on a Mac to test this and it was working for him -- could you please double check that you update to the latest version?)