Nitz
In SDL_x11mouse.c file there is function named
static Cursor
X11_CreatePixmapCursor(SDL_Surface * surface, int hot_x, int hot_y)
{
// Some code
data_bits = SDL_calloc(1, surface->h * width_bytes);
mask_bits = SDL_calloc(1, surface->h * width_bytes);
if (!data_bits || !mask_bits) {
SDL_OutOfMemory();
return None;
}
// Some code
}
Here is the problem in if statement,
suppose if !data_bits is false and !mask_bits is true then,
data_bits will go out of scope and leaks the memory it points to.
Solution is that data_bits and mask_bits should be checked separately, not by using OR operator.
Philipp Wiesemann
There is a NULL pointer dereference in SDL_AllocRW() if the system is out of memory. The "type" field is always written. This may be fixed with an early return.
Or an else{} or not writing the field and using slower SDL_calloc().
This fault was recently introduced (http://hg.libsdl.org/SDL/rev/681820ca0e78).
Fix numlock and pause keys not being pressable on win32, they both report under
the same scancode, so use the VK to tell them apart
--HG--
extra : histedit_source : ea129a468bd8ca3164b1aaea0fa143cf2e130b7b
Philipp Wiesemann
SDL_RWFromFile() sets an error to be queried with SDL_GetError() on Android although a valid SDL_RWops pointer is returned.
This happens if the fallback implemented in SDL_android.cpp is used to load compressed assets (see README.android in section "Loading assets") and results in a message like "java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed". I think this is confusing and not needed because the loading works as expected.
I attached a patch which changes SDL_android.cpp to not set an error if compressed assets are loaded. In this case also no Exception is queried and no additional string are created.
Philipp Wiesemann
SDL sets an error to be queried with SDL_GetError() for the initial touch on Android.
Android_OnTouch() in SDL_androidtouch.c uses SDL_GetTouch() to check if a touch device was already added. SDL_GetTouch() sets the error "Unknown touch device" for an out of range access because touch devices are added after initial touch. I think this error is confusing because it always happens by design.
I attached a patch which removes the call to SDL_GetTouch() and only uses SDL_AddTouch() which does the check (if already added) again and does not set an error (if not added yet).
This lets us change things like this...
if (Failed) {
SDL_SetError("We failed");
return -1;
}
...into this...
if (Failed) {
return SDL_SetError("We failed");
}
Fixes Bugzilla #1778.
Ryan C. Gordon
With this function...
SDL_UpdateWindowSurfaceRects(SDL_Window * window, SDL_Rect * rects, int numrects);
...is there any reason rects isn't "const SDL_Rect *" ?
All SDL_* functions are always available as real symbols, so you can always
link against them as a stable ABI. By default, however, all the things that
might have dithered down to macros in your application are now force-inlined,
to give you the same effect as before and theoretically better performance,
but still solve the classic macro problems.
Elsewhere, we provide real functions for these things that simply wrap the
inline functions, in case one needs to have a real function available.
Also: this exposed bugs: SDL_abs() does something different if you had the
macro vs the libc function, SDL_memcpy() returns a void* in the function
but not the macro, etc.
tomaszewski.p
According to API description:
SDL_RenderSetViewport - Use this function to set the drawing area for rendering on the current target.
DirectFB renderer in DirectFB_UpdateViewport function just sets clip on surface, instead of moving drawing area.
Attached patch uses set clip rectangle to move {x,y} coordinates during draw and blit operations to be compatible with API description.
tomaszewski.p
DirectFB renderer does not support SDL_RENDERER_TARGETTEXTURE what makes it incompatible with GL or GLES(2) renderers.
Attached patched:
- adds support for SDL_RENDERER_TARGETTEXTURE,
- DirectFB RenderCopy converts destination rectangle from floats to ints,
- fixes whitespaces to be the same in whole file.
Lee Salzman
When using SDL_GL_CreateContext() to create a >= 3.0 version or core/forward-compatible context, internally glXCreateContextAttribsARB is used. Mesa in particular seems to be having trouble with this call and returning all sorts of errors, so it is dangerous to poll for the highest GL version by using calls to SDL_GL_CreateContext unless you are sure, a priori, that the call will suceed, defeating the point of its use.
X11 protocol errors are of the following form, with varying details depending on user, but the cause is always SDL_GL_CreateContext as above...
X Error of failed request: GLXBadFBConfig
Major opcode of failed request: 153 (GLX)
Minor opcode of failed request: 34 ()
Serial number of failed request: 215
Current serial number in output stream: 221
These sorts of errors can be temporarily filtered out by setting an X11 error handler to catch and ignore them, which is safe with respect to SDL_GL_CreateContext behavior because this function is allowed to return NULL to indicate failure.
A patch is attached to do this temporary filtering/catching of errors generated by trying to use glXCreateContextAttribs and friends...
tomaszewski.p
Recent changes in SDL_sysrenderer.h and SDL_sysvideo.h had no impact on directfb backend.
Attached patch:
- updates interface,
- resolves uninitialized variable reading,
- changes logging tio use SDL_Log API,
- updates configure to use DIRECTFBCONFIG variable instead direct call to directfb-config.