Strange bug makes me suspicious of video library

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
amorphia
Prole
Posts: 8
Joined: Sat May 20, 2017 5:21 pm

Strange bug makes me suspicious of video library

Post by amorphia »

I'm hoping for some advice on a strange bug caused by a inexplicable interaction between the video library in love2d and my own code. At some point in my program, I play a video. If the video has played and finished playing, a later line of my own code causes a crash. If the video hasn't finished playing (it's still playing), my code doesn't cause the crash.

The line of my code that causes the crash is this:

Code: Select all

local slice = loadstring(script)()
Normally it crashes with no error (the console also quits) but more rarely I get a proper error report "attempt to call a nil value". The line in question is loading a table into memory by executing as code a string just loaded from file that does nothing but return a table (a way of storing 9 kB of table data outside my main.lua). I can give more details on that if needed. But basically, nothing in that code has anything to do with the video library or my video-related variables.

I have tried removing any code related to the ending of the video (not even testing whether it has ended). The crash still happens (unless the video hasn't finished - then it never crashes).

If I was coding in C then I would suspect some kind of error in my memory handling, but seeing as I basically can't do that in lua then I suspect the video library of some mishandling of something. There is something more that I think probably proves this bug is not of my own making: the exact same code runs fine on someone else's computer (I have Windows 7 and she has Windows 10, we both have the latest Love2d).

I have tried (after the video has played) setting the variable holding the video to nil, and I have tried running garbagecollection(), but this bug still happens. Any advice for how to avoid it gratefully received!
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Strange bug makes me suspicious of video library

Post by bartbes »

It's definitely possible there are bugs, it's a fairly new and complex beast, but I don't think it's that bad. Can you share some (preferably minimal) example code which demonstrates this issue?
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 2 guests