Resolved: [Bug Report & patch] double free & gtk trouble with zeropad under linux
#1
Hello,
I've found two problem with zeropad (svn version) under my linux (debian lenny/squeeze with a 2.6.31)

I use the svn revision 396

The first trouble is : if i open the controller config windows, i close it, then i reopen it, the system will launch me a "double free or corruption" then kill the soft with a sigabrt.

With some investigation, this problem was resolved with this little modification

===================================================================
--- linux.cpp (révision 396)
+++ linux.cpp (copie de travail)
@@ -721,7 +721,8 @@
}

vector<JoystickInfo*>::iterator it;
- FORIT(it, vjoysticks) delete *it;
+ vjoysticks.clear();

vjoysticks.resize(SDL_NumJoysticks());
for(int i = 0; i < (int)vjoysticks.size(); ++i) {

The Joystickinfo must have been deleted elsewhere (but I haven't investigate it), so just clear them will be ok.
I've first try to put "*it" to null after the delete, but it doesn' correct the double free.


The second problem is a bit more funny (always on this plugin)
When I change only a button (with a joystick button), it is saved without trouble.
But if i change more than one, the software display the right buttons, but save only the first ! (for example : if i put triangle with JBut1 and after this square with JBut2 , only jbut1 will be saved).


After a bit more of investigation, i have found that this comportement was caused by "savestate".
I've done a workaround, but i can't say why it doesn't work before.
Here my workaround:
(I just hope that "=" on a vector do a clone )
===================================================================
--- linux.cpp (révision 396)
+++ linux.cpp (copie de travail)
@@ -816,11 +817,18 @@

void JoystickInfo:WackoaveState()
{
+
#ifdef JOYSTICK_SUPPORT
+ vector<int> a,b;
+ a.resize(numbuttons);
+ b.resize(numaxes);
+
for(int i = 0; i < numbuttons; ++i)
- vbutstate[i] = SDL_JoystickGetButton(joy, i);
+ a[i] = SDL_JoystickGetButton(joy, i);
for(int i = 0; i < numaxes; ++i)
- vaxisstate[i] = SDL_JoystickGetAxis(joy, i);
+ b[i] = SDL_JoystickGetAxis(joy, i);
+ vbutstate=a;
+ vaxisstate=b;
#endif
}

Sponsored links

#2
Thank you for your report.
This bug report has now been marked as Resolved since it has been fixed on our code base.

This thread will now be closed and moved to the resolved bug reports subforum.




Users browsing this thread: 1 Guest(s)