acedSSGet crasch when not selecting an object

I have a plugin that uses the following code: acedSSGet(_T(":$"), prompts, NULL, NULL, entres);

It allowes the user to select objects and that works fine unless you click outside an object. If you click somethere in empty space BricsCad crasch and gives following error:
"Unhandled exception at 0x00007FF9ED7EFF5A (ntdll.dll) in bricscad.exe: 0xC000041D"

Comments

  • i've been using similar code for years with success.
    its wrapped in a class but, you'll get the idea

    AcDbObjectIdArray SelectionSet::Select()
    {
    AcDbObjectIdArray m_ids;
    if (acedSSGet(m_mode, m_point1, m_point2, m_filter, m_ss) == RTNORM)
    {
    if (acedSSLength(m_ss, &m_length) == RTNORM)
    {
    if (auto es = acedGetCurrentSelectionSet(m_ids); es != eOk)
    acutPrintf(_T("\nSelection error = %ls :"), acadErrorStatusText(es));
    }
    }
    return m_ids;
    }
  • Samuel_A
    edited October 2022
    It is more or less the same routine as I am using. It's the acedSSGet command that crasch If I click outside an object. When you click on empty space you get the selection rectangle and that is what you get when you click outside an object with acedSSGet so a selection rectangle crasch this command.
    When I do the same in AutoCad it just show "0 entities selected" so it works in AutoCad.
  • Its_Alive
    edited October 2022
    Are you using V22?
    Sorry, I could not reproduce it with this code

    static void CArxTest_doit()
    {
    try
    {
    struct resbuf* filter = acutBuildList(RTDXF0, ACRX_T("POINT"), RTNONE);
    const ACHAR* prompt[] = { ACRX_T("\nSelect Points: "), ACRX_T("\nRemove Points: ") };
    const ACHAR* mode = ACRX_T(":$");
    ads_name ss = { 0L };

    AcDbObjectIdArray ids;
    if (acedSSGet(mode, prompt, NULL, filter, ss) == RTNORM)
    {
    auto es = acedGetCurrentSelectionSet(ids);
    if (es != eOk)
    acutPrintf(_T("\nSelection error = %ls :"), acadErrorStatusText(es));
    acutRelRb(filter);
    acedSSFree(ss);
    }
    }
    catch (...)
    {
    acutPrintf(_T("\nException in acedSSGet: "));
    }
    }
  • Yes with V22. It crash in the acedSSGet command. If I set a breakpoint just after it I can see that I never reach that line, but entire BricsCad crash on the acedSSGet command when selecting "nothing" (click outside so the select box appear).
  • I tried to add "try / catch" and that could capture the exception so now I can fix the crasch by just ignore it if catch trigger. So that is helpfull!