User Tag List

Results 1 to 3 of 3

Thread: Application crashed in some cases when calling an event via expression

  1. #1
    Clicker Install Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    defisym's Avatar
    Join Date
    Jun 2017
    Location
    Asia
    Posts
    286
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    Application crashed in some cases when calling an event via expression

    Hi all, I'm now trying to make my own function object (link to the repo).

    Ideally I want to get return values directly from an expression, so I need to call an event via expression.
    Call back function
    Code:
    callRunTimeFunction(rdPtr, RFUNCTION_GENERATEEVENT, X, 0)
    in an expression routine can call the event properly, but soon I encountered some issues:

    Application will crash if the last child of "On Func" event has only an single action that refers another object:



    ...but if you add anything else to it, app will run properly:



    ...or make sure last child has an action of object which triggers this immediate condition:



    or just simply don't use child event:



    Application still crashed even if I comment all lines of code that do the work in Visual Studio (expection (access violation) is throwed by fusion runtime, out of my code range) but works properly with normal events. So I think this might be a bug about child event.

    Application crashed when nest object's expression that will call an event

    I also made a ternary expression. if I want to nest it with expression function calls, application will crash:



    when I step-in in VS, app crashes when I trying to get the second param (access violation):



    and
    Code:
    CNC_GetNextExpressionParameter(rdPtr, param1, TYPE_FLOAT)
    is a callback of fusion, so I think this case may also a bug of fusion expression routine.

    Here follows the mfa that contains the issue:

    FuncIssue.mfa

    Please uncomment each case to check the issue.

    You can download the .mfx and help file here:

    https://github.com/defisym/OpenFusio...oInstall/Files

    Thanks in advance.

  2. #2
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    14,172
    Mentioned
    279 Post(s)
    Tagged
    3 Thread(s)
    I think GENERATE_EVENT was not designed originally to be called from an expression.

    To fix the crash, save rdPtr->rHo.hoAdRunHeader->rh4.rh4ExpToken before calling CallEvent and restore it just after:

    Code:
    	LPRH pRh = rdPtr->rHo.hoAdRunHeader;
    	expression*	saveExpToken = pRh->rh4.rh4ExpToken;
    	CallEvent(ONFUNC);
    	pRh->rh4.rh4ExpToken = saveExpToken;
    I'll add this code to GenerateEvent in the next build.

  3. #3
    Clicker Install Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    defisym's Avatar
    Join Date
    Jun 2017
    Location
    Asia
    Posts
    286
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Yves View Post
    I think GENERATE_EVENT was not designed originally to be called from an expression.

    To fix the crash, save rdPtr->rHo.hoAdRunHeader->rh4.rh4ExpToken before calling CallEvent and restore it just after:

    Code:
    	LPRH pRh = rdPtr->rHo.hoAdRunHeader;
    	expression*	saveExpToken = pRh->rh4.rh4ExpToken;
    	CallEvent(ONFUNC);
    	pRh->rh4.rh4ExpToken = saveExpToken;
    I'll add this code to GenerateEvent in the next build.
    Thanks! problem fixed here, this make it very handy to do some quick calculations!

Similar Threads

  1. Replies: 0
    Last Post: 2nd February 2021, 09:17 AM
  2. Correct expression for random direction event
    By Wodjanoi in forum Fusion 2.5
    Replies: 3
    Last Post: 17th August 2017, 10:59 AM
  3. Application crashed on iphone
    By evi1ove in forum iOS Export Module 2.5
    Replies: 9
    Last Post: 2nd August 2016, 06:32 AM
  4. calling another application inside the application
    By Cody in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 11th June 2010, 04:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •