Announcement

Collapse
No announcement yet.

[Bug] Dynamic Delegate AddDynamic Macro Incorrectly Parses Function Name

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [Bug] Dynamic Delegate AddDynamic Macro Incorrectly Parses Function Name

    When using the AddDynamic macro of a dynamic delegate, line breaks can cause the function name to be incorrectly parsed.

    For instance:

    delegate->AddDynamic(this, &UMyClass::MyFunction)

    works fine.

    However,

    delegate->AddDynamic(this, &UMyClass::
    MyFunction)


    fails.

    In the second case, the AddDynamic macro expansion retains the space between the :: and MyFunction, i.e. the macro sees the function as "&UMyClass:: MyFunction". Eventually this is passed to GetTrimmedMemberFunctionName, which retains everything after the :: as the function name, including the extra space, i.e. " MyFunction" in this case.

    The easiest fix would be to trim leading spaces in the function name when removing the "<Class>::" prefix.


    #2
    Well the easiest fix really is to just remove the line-break

    I feel like trimming the function name just adds unnecessary bulk to the GetTrimmedMemberFunctionName() function which will ultimately bloat the cost of this everywhere. String parsing isn't all that cheap.

    Comment

    Working...
    X