• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Thread crashing?

Status
Not open for further replies.
Level 21
Joined
Aug 21, 2005
Messages
3,699
While making a system for a clan project, I encountered a problem I haven't been able to solve so far...

Some of you might (or might not) know the "InputMsg" function made by vexorian: it displays a dialog with certain options and returns an integer declaring the chosen option. Well, it has always been working so far, but it looks like the dialog is causing a thread crash as soon as it is shown.

In-game, writing "-dialog" will show a test dialog, which is working perfectly fine.
But when you create a team, and try to disband it (using the abilities on your hero), the disband dialog shows, but the dialog crashes and thus I'm currently not able to disband my team... Online tests also showed the same happens when inviting another player to your team. Those are the only 2 occasions I use dialogs.

The functions that make use of the Dialog are: Team.invitePlayer and Team.disband...

What is the cause of this problem and how do I solve it?
 

Attachments

  • Team System.w3x
    28.6 KB · Views: 32
Level 21
Joined
Aug 21, 2005
Messages
3,699
But why would the code move on in a method but not in a normal function? I mean, when I'm using it in a normal trigger there's no problem, but when I use it in a method the trigger just stops...

It also stops displaying debug messages after the dialog shows, so I think the thread is crashing rather than the code simply moving on...
 

peq

peq

Level 6
Joined
May 13, 2007
Messages
171
JASS:
struct test
    method tester takes nothing returns nothing
        call .evaluateme()
    endmethod
    
    method evaluateme takes nothing returns nothing
    endmethod
endstruct

gets compiled to

JASS:
globals

//JASSHelper struct globals:
constant integer si__test=1
integer si__test_F=0
integer si__test_I=0
integer array si__test_V
trigger st__test_evaluateme
integer f__arg_this

endglobals

//Generated method caller for test.evaluateme
function sc__test_evaluateme takes integer this returns nothing
    set f__arg_this=this
    call TriggerEvaluate(st__test_evaluateme)
endfunction

//Generated allocator of test
function s__test__allocate takes nothing returns integer
 local integer this=si__test_F
    if (this!=0) then
        set si__test_F=si__test_V[this]
    else
        set si__test_I=si__test_I+1
        set this=si__test_I
    endif
    if (this>8190) then
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1000.,"Unable to allocate id for an object of type: test")
        return 0
    endif

    set si__test_V[this]=-1
 return this
endfunction

//Generated destructor of test
function s__test_destroy takes integer this returns nothing
    if this==null then
            call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1000.,"Attempt to destroy a null struct of type: test")
        return
    elseif (si__test_V[this]!=-1) then
            call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1000.,"Double free of type: test")
        return
    endif
    set si__test_V[this]=si__test_F
    set si__test_F=this
endfunction

    function s__test_tester takes integer this returns nothing
        call sc__test_evaluateme(this)
    endfunction
    
    function s__test_evaluateme takes integer this returns nothing
    endfunction


//Struct method generated initializers/callers:
function sa__test_evaluateme takes nothing returns boolean
local integer this=f__arg_this
   return true
endfunction

function jasshelper__initstructs8318378 takes nothing returns nothing
    set st__test_evaluateme=CreateTrigger()
    call TriggerAddCondition(st__test_evaluateme,Condition( function sa__test_evaluateme))

endfunction
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
It uses TriggerEvaluate? That sucks terribly. And no mention of that in the manual sucks even harder.

Any way to easily fix this? Well, any way to fix this in the first place, except messing with the mapscript? Changing that Dialog function of vexorian with timers sounds a pain in the ass too...
 
Status
Not open for further replies.
Top