1. Anders Ruud
  2. love

Issues

Issue #111 invalid

Creating framebuffers in threads

Boolsheet
created an issue

LÖVE terminates with SIGABRT if I try to create a framebuffer in a thread. Is this expected behaviour? \ main.lua: {{{

!lua

function love.load() love.thread.newThread("1", "thread.lua"):start() end }}} \ thread.lua: {{{

!lua

require("love.filesystem") require("love.image") require("love.graphics") require("love.timer") require("love.event") require("love.mouse") require("love.keyboard")

local fb = love.graphics.newFramebuffer() }}} \ Backtrace following...

Comments (6)

  1. Boolsheet reporter
    [Thread debugging using libthread_db enabled]
    [New Thread 0xb7f4eb70 (LWP 1775)]
    [New Thread 0xb374cb70 (LWP 1776)]
    [New Thread 0xb2c6cb70 (LWP 1777)]
    [New Thread 0xb1fe1b70 (LWP 1778)]
    terminate called after throwing an instance of 'std::logic_error'
      what():  basic_string::_S_construct NULL not valid
    
    Program received signal SIGABRT, Aborted.
    [Switching to Thread 0xb1fe1b70 (LWP 1778)]
    0x0012e416 in __kernel_vsyscall ()
    (gdb) bt
     #0  0x0012e416 in __kernel_vsyscall ()
     #1  0x00729941 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
     #2  0x0072ce42 in abort () at abort.c:92
     #3  0x00680055 in __gnu_cxx::__verbose_terminate_handler() ()
       from /usr/lib/libstdc++.so.6
     #4  0x0067df35 in ?? () from /usr/lib/libstdc++.so.6
     #5  0x0067df72 in std::terminate() () from /usr/lib/libstdc++.so.6
     #6  0x0067e0e1 in __cxa_throw () from /usr/lib/libstdc++.so.6
     #7  0x00622faf in std::__throw_logic_error(char const*) ()
       from /usr/lib/libstdc++.so.6
     #8  0x00660bd2 in char* std::basic_string<char, std::char_traits<char>,
        std::allocator<char> >::_S_construct<char const*>(char const*,
        char const*, std::allocator<char> const&, std::forward_iterator_tag) ()
       from /usr/lib/libstdc++.so.6
     #9  0x006612f5 in std::basic_string<char, std::char_traits<char>,
        std::allocator<char> >::basic_string(char const*,
        std::allocator<char> const&) ()
       from /usr/lib/libstdc++.so.6
     #10 0x080640a0 in (anonymous namespace)::getOpenGLVersionNumber ()
        at modules/graphics/opengl/Framebuffer.cpp:29
     #11 0x08064a3e in love::graphics::opengl::Framebuffer::Framebuffer (
        this=0xb1642860, width=800, height=600)
        at modules/graphics/opengl/Framebuffer.cpp:196
     #12 0x0805d61f in love::graphics::opengl::Graphics::newFramebuffer (
        this=0x81db928, width=800, height=600)
        at modules/graphics/opengl/Graphics.cpp:482
     #13 0x0808b04a in love::graphics::opengl::w_newFramebuffer (L=0x85a3308)
        at modules/graphics/opengl/wrap_Graphics.cpp:307
     #14 0x004182ea in luaD_precall (L=0x85a3308, func=0x85a3560, nresults=1)
        at ldo.c:319
     #15 0x0042345a in luaV_execute (L=0x85a3308, nexeccalls=1) at lvm.c:587
     #16 0x004187d0 in luaD_call (L=0x85a3308, func=0x85a3554, nResults=-1)
        at ldo.c:377
     #17 0x00413771 in f_call (L=0x85a3308, ud=0xb1fe1278) at lapi.c:800
     #18 0x00417df3 in luaD_rawrunprotected (L=0x85a3308, f=0x413750 <f_call>, 
        ud=0xb1fe1278) at ldo.c:116
     #19 0x00417e55 in luaD_pcall (L=0x85a3308, func=0x413750 <f_call>, 
        u=0xb1fe1278, old_top=36, ef=0) at ldo.c:463
     #20 0x00413598 in lua_pcall (L=0x85a3308, nargs=0, nresults=-1, errfunc=0)
        at lapi.c:821
     #21 0x080fcec7 in love::thread::sdl::threadfunc (comm=0x8589f38)
        at modules/thread/sdl/Thread.cpp:50
     #22 0x0055380e in ?? () from /usr/lib/libSDL-1.2.so.0
     #23 0x0059b70d in ?? () from /usr/lib/libSDL-1.2.so.0
     #24 0x00862cc9 in start_thread (arg=0xb1fe1b70) at pthread_create.c:304
     #25 0x007cf6ae in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
    (gdb)
    
    
  2. Matthias Richter

    Reproducable, but with a different stack trace.

    0x00007ffff5d9a2c9 in glGetError () from //usr/lib64/opengl/nvidia/lib/libGL.so.1
    (gdb) bt
    # 0  0x00007ffff5d9a2c9 in glGetError () from //usr/lib64/opengl/nvidia/lib/libGL.so.1
    # 1  0x0000000000477239 in love::graphics::opengl::w_newFramebuffer (L=0x926b40) at modules/graphics/opengl/wrap_Graphics.cpp:306
    # 2  0x00007ffff6482051 in luaD_precall () from //usr/lib64/liblua.so.5
    # 3  0x00007ffff648cc88 in luaV_execute () from //usr/lib64/liblua.so.5
    # 4  0x00007ffff648250d in luaD_call () from //usr/lib64/liblua.so.5
    # 5  0x00007ffff6481bc7 in luaD_rawrunprotected () from //usr/lib64/liblua.so.5
    # 6  0x00007ffff6481c40 in luaD_pcall () from //usr/lib64/liblua.so.5
    # 7  0x00007ffff647d6c1 in lua_pcall () from //usr/lib64/liblua.so.5
    # 8  0x00000000004e5995 in love::thread::sdl::threadfunc (comm=0x925cd0) at modules/thread/sdl/Thread.cpp:50
    # 9  0x00007ffff585d995 in SDL_RunThread () from //usr/lib64/libSDL-1.2.so.0
    # 10 0x00007ffff5897499 in RunThread () from //usr/lib64/libSDL-1.2.so.0
    # 11 0x00007ffff4b24c1a in start_thread () from /lib/libpthread.so.0
    # 12 0x00007ffff4e0ccad in clone () from /lib/libc.so.6
    (gdb) frame 1
    # 1  0x0000000000477239 in love::graphics::opengl::w_newFramebuffer (L=0x926b40) at modules/graphics/opengl/wrap_Graphics.cpp:306
    306			glGetError(); // clear opengl error flag
    (gdb) list
    301		int w_newFramebuffer(lua_State * L)
    302		{
    303			// check if width and height are given. else default to screen dimensions.
    304			int width  = luaL_optint(L, 1, instance->getWidth());
    305			int height = luaL_optint(L, 2, instance->getHeight());
    306			glGetError(); // clear opengl error flag
    307			Framebuffer * framebuffer = instance->newFramebuffer(width, height);
    308	
    309			//and there we go with the status... still disliked
    310			if (framebuffer->getStatus() != GL_FRAMEBUFFER_COMPLETE) {
    

    With commenting out require("love.graphics") it does not crash anymore.

  3. Log in to comment