Skip to content

Commit

Permalink
Try and fix Linux x64 crash, also ignore InvalidStateError on chunk g…
Browse files Browse the repository at this point in the history
…eneration
  • Loading branch information
matpow2 committed Jul 29, 2017
1 parent d329822 commit 934171f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions cuwo/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,10 @@ def __init__(self, world, pos):
self.gen_f.add_done_callback(self.on_chunk)

def on_chunk(self, f):
if f.cancelled():
try:
self.data = f.result()
except asyncio.CancelledError:
return
self.data = f.result()

region = (self.data.x // 64, self.data.y // 64)
if region in self.world.regions:
self.region = self.world.regions[region]
Expand Down Expand Up @@ -528,8 +528,8 @@ def run_gen(self, seed):
pos, f = data
res = tgen.generate(*pos)
def set_result():
if f.cancelled():
try:
f.set_result(res)
except asyncio.InvalidStateError:
return
f.set_result(res)

self.loop.call_soon_threadsafe(set_result)
1 change: 1 addition & 0 deletions terraingen/tgen2/tools/createwrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
mov rsp, rbp
pop rbp
ret
'''

set_stack_call_msvc = '''
Expand Down
2 changes: 1 addition & 1 deletion terraingen/tgen2/tools/wrapper_x64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,7 @@ uint32_t (*_run_with_stack)(void*, void*, void (*f)());
unsigned char _run_with_stack_asm[] = {
0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xe7, 0xf0, 0x48, 0x81, 0xef,
0x80, 0x0, 0x0, 0x0, 0x48, 0x89, 0xfc, 0xff, 0xd2, 0x48, 0x89, 0xec,
0x5d
0x5d, 0xc3
};

#define SETUP_CALLERS()\
Expand Down

0 comments on commit 934171f

Please sign in to comment.