Фатальная ошибка libgdx

239
26 декабря 2017, 17:00

Во время выполнения кода:

new Bonus(body.getWorld(),body.getPosition().x,body.getPosition().y);
body.setActive(false);
body.getWorld().destroyBody(body);

Код выполняется после world.step()

Сама ошибка появляется во время вызова body = world.createBody(def);

Конструктор Bonus():

public Bonus(World world, float x, float y) {
    BodyDef def = new BodyDef();
    def.type = BodyDef.BodyType.DynamicBody;
    def.position.set(x,y);
    body = world.createBody(def);
    FixtureDef fd = new FixtureDef();
    fd.friction = 0;
    fd.restitution = 1;
    CircleShape shape = new CircleShape();
    shape.setRadius(RADIUS);
    fd.shape = shape;
    body.createFixture(fd);
    body.setUserData(this);
    body.setLinearVelocity(0,Y_VELOCITY);
}

Фатальная ошибка:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000066bcbd0d, pid=3360, tid=0x00000000000025dc
#
# JRE version: OpenJDK Runtime Environment (8.0_152-b01) (build 1.8.0_152-release-915-b01)
# Java VM: OpenJDK 64-Bit Server VM (25.152-b01 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [gdx-box2d64.dll+0xbd0d]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
---------------  T H R E A D  ---------------
Current thread (0x0000000019db5800):  JavaThread "LWJGL Application" [_thread_in_native, id=9692, stack(0x000000001ab50000,0x000000001ac50000)]
siginfo: ExceptionCode=0xc0000005, reading address 0x000000021a79ea00
Registers: RAX=0x000000021a79ea00, RBX=0x000000001a783cf0, RCX=0x000000001a783cc0, RDX=0x00000000000000b8 RSP=0x000000001ac4e5e0, RBP=0x0000000000000006, RSI=0x000000001a783cc0, RDI=0x000000001ac4e6a0 R8 =0x000000001a783cc0, R9 =0x0000000000000002, R10=0x0000000000000000, R11=0x0000000000000001 R12=0x0000000000000000, R13=0x000000001770fb28, R14=0x000000001ac4e888, R15=0x0000000019db5800 RIP=0x0000000066bcbd0d, EFLAGS=0x0000000000010206
Top of Stack: (sp=0x000000001ac4e5e0) 0x000000001ac4e5e0:   000000001770fb28 0000000019db5800 0x000000001ac4e5f0:   000000007485e478 0000000019f3bb00 0x000000001ac4e600:   0000000000000012 000000001a783cc0 0x000000001ac4e610:   0000000000000dd8 000000001ac4e6a0 0x000000001ac4e620:   000000001ac4e7e0 0000000000000000 0x000000001ac4e630:   000000001770fb28 0000000066be2483 0x000000001ac4e640:   000000001ac4e6e0 000000001ac4e6e0 0x000000001ac4e650:   0000000000000003 000000001770fb28 0x000000001ac4e660:   0000000000000001 0000000000000dd8 0x000000001ac4e670:   0000000000051250 0000000066be8616 0x000000001ac4e680:   0000000000000000 0000000000051250 0x000000001ac4e690:   000000001ac4e7e0 00000000053e54d8 0x000000001ac4e6a0:   41bb999a00000002 00000000419f3333 0x000000001ac4e6b0:   0000000000000000 0000000000000000 0x000000001ac4e6c0:   0000010100000000 000000001ac4e801 0x000000001ac4e6d0:   0000000000000000 000000003f800000 
Instructions: (pc=0x0000000066bcbd0d) 0x0000000066bcbced:   48 8d 05 6c a3 05 00 0f b6 1c 18 80 fb 0d 0f b6 0x0000000066bcbcfd:   eb 77 21 48 8d 1c de 48 8b 43 10 48 85 c0 74 3a 0x0000000066bcbd0d:   48 8b 10 48 89 53 10 48 83 c4 28 5b 5e 5f 5d 41 0x0000000066bcbd1d:   5c 41 5d c3 48 8d 15 18 9e 04 00 48 8d 0d 99 9e 

Register to memory mapping:
RAX=0x000000021a79ea00 is an unknown value RBX=0x000000001a783cf0 is an unknown value RCX=0x000000001a783cc0 is an unknown value RDX=0x00000000000000b8 is an unknown value RSP=0x000000001ac4e5e0 is pointing into the stack for thread: 0x0000000019db5800 RBP=0x0000000000000006 is an unknown value RSI=0x000000001a783cc0 is an unknown value RDI=0x000000001ac4e6a0 is pointing into the stack for thread: 0x0000000019db5800 R8 =0x000000001a783cc0 is an unknown value R9 =0x0000000000000002 is an unknown value R10=0x0000000000000000 is an unknown value R11=0x0000000000000001 is an unknown value R12=0x0000000000000000 is an unknown value R13={method} {0x000000001770fb30} 'jniCreateBody' '(JIFFFFFFFFZZZZZF)J' in 'com/badlogic/gdx/physics/box2d/World' R14=0x000000001ac4e888 is pointing into the stack for thread: 0x0000000019db5800 R15=0x0000000019db5800 is a thread

Stack: [0x000000001ab50000,0x000000001ac50000],  sp=0x000000001ac4e5e0,  free space=1017k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C  [gdx-box2d64.dll+0xbd0d] C  [gdx-box2d64.dll+0x22483] C  [gdx-box2d64.dll+0x28616] C  0x00000000053f59d4
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j  com.badlogic.gdx.physics.box2d.World.jniCreateBody(JIFFFFFFFFZZZZZF)J+0 j  com.badlogic.gdx.physics.box2d.World.createBody(Lcom/badlogic/gdx/physics/box2d/BodyDef;)Lcom/badlogic/gdx/physics/box2d/Body;+80 j  com.testgame.arkanoid.Objects.Bonus.<init>(Lcom/badlogic/gdx/physics/box2d/World;FF)V+36 j  com.testgame.arkanoid.Objects.Block.setDamage()V+63 J 941 C1 com.testgame.arkanoid.Screens.ScreenGame.render(F)V (1517 bytes) @ 0x0000000005767364 [0x0000000005760c40+0x6724] j  com.badlogic.gdx.Game.render()V+19 j  com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop()V+698 j  com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run()V+27 v  ~StubRoutines::call_stub
Answer 1

В Box2d обьект может удаляться 2 раза, а тому нужно сделать что-то типа

if(body.isActive())
{
      body.setActive(false);
      body.setUserData(null);
      body.getWorld().destroyBody(body);
      body = null;
}
READ ALSO
Можно ли с помощью shell открыть закладку chrome apk?

Можно ли с помощью shell открыть закладку chrome apk?

Есть ли быстрый способ запустить командно одну из закладок Google Chrome?

306
Кодировка в запросах из Java

Кодировка в запросах из Java

Есть Tomcat 8 + сервлеты, IDE - Eclipse, ОС - Debian 9Из сервлетов посылаю GET-запрос на удаленный сервер (указав кодировку в запросе

386
sqlite. Как создать атрибут типа Date

sqlite. Как создать атрибут типа Date

Глядя на уроки на просторах интернета вижу, что добавляют данные в базу используя ContentValuesНо конструктора принимающего тип Date там нет

334