This is causing me to go insane

Questions, comments, and news on the server side plug-ins and it's API
Post Reply
Enigma
Private First Class
Private First Class
Posts: 212
Joined: Sat Apr 23, 2005 3:13 am

This is causing me to go insane

Post by Enigma »

Holy crap I have spent tons of time trying to find out what is causing people to go NR when I load a plug-in that I have been working on. After many many many many hours, I finally found what it causing it:

Code: Select all

bzAPIIntList *list = NULL;
  bz_getPlayerIndexList(list);
 bz_deleteIntList(list);
When I load my plug-in without that code, it runs fine; however, when I load the plug-in with it, everyone goes NR, and the server terminates. When it does terminate, BZFS says, "Bus error."

I'm using version 2.0.10 from SVN, which was updated (on my system) a few days ago.

I should probably also mention I was using bots (bzflag -solo N). I'm not sure if it matters though.
User avatar
L4m3r
Hater of Everything
Hater of Everything
Posts: 724
Joined: Tue Feb 08, 2005 5:15 am
Location: Los Angeles

Post by L4m3r »

iirc, that function is supposed to fill the int list, not create it.

When I use it, I just declare an int list and pass its address to the function with &.
Optimism is just a milder alternative to denial.
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

do not declare the int list in the plug-in

use the bz_newIntList function to get the list;

it should look like this

Code: Select all

bzAPIIntList *list = bz_newIntList ();
if (list)
{
  bz_getPlayerIndexList(list);

  // do stuff

  bz_deleteIntList(list);
}
not all OSs can allocate the list in the plug-in.
ImageJeffM
User avatar
L4m3r
Hater of Everything
Hater of Everything
Posts: 724
Joined: Tue Feb 08, 2005 5:15 am
Location: Los Angeles

Post by L4m3r »

Oh, right, the Windows problem. Forgot about that. :oops:
Optimism is just a milder alternative to denial.
Enigma
Private First Class
Private First Class
Posts: 212
Joined: Sat Apr 23, 2005 3:13 am

Post by Enigma »

Wow, thanks! That was a quick response. I guess it's been a while since I used bz_getPlayerIndexList(). I thought it allocated the intList.
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

it will for 3.0 in the new API
ImageJeffM
Post Reply