Re: [pygame] BUG: Segfault when rotating a HWSURFACE

2007-05-16 Thread John Popplewell
On Wed, May 16, 2007 at 11:19:01AM +1000, René Dudfield wrote:
 Thanks John.
 
 There's been a bunch more cleanups because of the new gcc warning
 flags Marcus added.  He's gone through and fixed a few things because
 of those warnings...  I think these warnings should show up the
 problem you found with movie.c in the future.
 
 Would you be able to test it again to see if it's ok with the
 Microsoft compiler now?

Hi René, 

I checked out version 1007 and it builds fine with MS 13.10.3077.
Looking forward to the next release :-)

cheers,
John.



Re: [pygame] BUG: Segfault when rotating a HWSURFACE

2007-05-15 Thread René Dudfield

Thanks John, and John.

Committed revision 1004.

On 5/15/07, John Popplewell [EMAIL PROTECTED] wrote:

On Mon, May 14, 2007 at 02:52:38PM -0600, John Krukoff wrote:
 import sys, pygame

 pygame.init( )
 screen = pygame.display.set_mode( ( 640, 480 ), pygame.HWSURFACE | 
pygame.DOUBLEBUF | pygame.FULLSCREEN )
 hwSurface = pygame.surface.Surface( ( 64, 64 ), pygame.HWSURFACE )
 hwSurface.fill( ( 0, 0, 0 ) )
 print 'Should show 1 to indicate hardware surface:', hwSurface.get_flags( )
 # Crash occurs on next line.
 rotated = pygame.transform.rotate( hwSurface, 1 )
 print 'Will never be displayed.'
 sys.exit( 0 )

I can reproduce this with the latest svn although I have to set an environment
variable to get the directx backend (with actual hardware surfaces). Here is a
patch to fix it:

Index: src/transform.c
===
--- src/transform.c (revision 1003)
+++ src/transform.c (working copy)
@@ -528,6 +528,7 @@
}
else
{
+   SDL_LockSurface(surf);
switch(surf-format-BytesPerPixel)
{
case 1: bgcolor = *(Uint8*)surf-pixels; break;
@@ -540,6 +541,7 @@
bgcolor = (((Uint8*)surf-pixels)[2]) + 
(((Uint8*)surf-pixels)[1]8) + (((Uint8*)surf-pixels)[0]16);
 #endif
}
+   SDL_UnlockSurface(surf);
bgcolor = ~surf-format-Amask;
}


Whilst I was doing this I found a small regression building movie.c on Windows
with the Microsoft compiler. Here is a patch to fix it:

Index: src/movie.c
===
--- src/movie.c (revision 1003)
+++ src/movie.c (working copy)
@@ -148,8 +148,8 @@

if(posobj == NULL)
{
+   SMPEG_Info info;
 Py_BEGIN_ALLOW_THREADS
-   SMPEG_Info info;
SMPEG_getinfo(movie, info);
SMPEG_scaleXY(movie, info.width, info.height);
 Py_END_ALLOW_THREADS
@@ -157,8 +157,8 @@
}
else if(TwoIntsFromObj(posobj, x, y))
{
+   SMPEG_Info info;
 Py_BEGIN_ALLOW_THREADS
-   SMPEG_Info info;
SMPEG_getinfo(movie, info);
SMPEG_scaleXY(movie, info.width, info.height);
 Py_END_ALLOW_THREADS

Hope this helps,

regards,
John.




Re: [pygame] BUG: Segfault when rotating a HWSURFACE

2007-05-14 Thread John Popplewell
On Mon, May 14, 2007 at 02:52:38PM -0600, John Krukoff wrote:
 import sys, pygame
 
 pygame.init( )
 screen = pygame.display.set_mode( ( 640, 480 ), pygame.HWSURFACE | 
 pygame.DOUBLEBUF | pygame.FULLSCREEN )
 hwSurface = pygame.surface.Surface( ( 64, 64 ), pygame.HWSURFACE )
 hwSurface.fill( ( 0, 0, 0 ) )
 print 'Should show 1 to indicate hardware surface:', hwSurface.get_flags( )
 # Crash occurs on next line.
 rotated = pygame.transform.rotate( hwSurface, 1 )
 print 'Will never be displayed.'
 sys.exit( 0 )

I can reproduce this with the latest svn although I have to set an environment
variable to get the directx backend (with actual hardware surfaces). Here is a
patch to fix it:

Index: src/transform.c
===
--- src/transform.c (revision 1003)
+++ src/transform.c (working copy)
@@ -528,6 +528,7 @@
}
else
{
+   SDL_LockSurface(surf);
switch(surf-format-BytesPerPixel)
{
case 1: bgcolor = *(Uint8*)surf-pixels; break;
@@ -540,6 +541,7 @@
bgcolor = (((Uint8*)surf-pixels)[2]) + 
(((Uint8*)surf-pixels)[1]8) + (((Uint8*)surf-pixels)[0]16);
 #endif
}
+   SDL_UnlockSurface(surf);
bgcolor = ~surf-format-Amask;
}


Whilst I was doing this I found a small regression building movie.c on Windows
with the Microsoft compiler. Here is a patch to fix it:

Index: src/movie.c
===
--- src/movie.c (revision 1003)
+++ src/movie.c (working copy)
@@ -148,8 +148,8 @@
 
if(posobj == NULL)
{
+   SMPEG_Info info;
 Py_BEGIN_ALLOW_THREADS
-   SMPEG_Info info;
SMPEG_getinfo(movie, info);
SMPEG_scaleXY(movie, info.width, info.height);
 Py_END_ALLOW_THREADS
@@ -157,8 +157,8 @@
}
else if(TwoIntsFromObj(posobj, x, y))
{
+   SMPEG_Info info;
 Py_BEGIN_ALLOW_THREADS
-   SMPEG_Info info;
SMPEG_getinfo(movie, info);
SMPEG_scaleXY(movie, info.width, info.height);
 Py_END_ALLOW_THREADS

Hope this helps,

regards,
John.



Re: [pygame] BUG: Segfault when rotating a HWSURFACE

2007-05-12 Thread Rikard Bosnjakovic

On 5/10/07, John Krukoff [EMAIL PROTECTED] wrote:


Is this a known problem?


Unheard of.

Please provide shortest possible sample code to reproduce the error.


--
- Rikard - http://bos.hack.org/cv/