I have narrowed the issue down to a difference in behaviour between Windows and Wine.

The problem boils down to the following code:

  NONCLIENTMETRICS ncm;
  memset(&ncm, 0, sizeof(NONCLIENTMETRICS));
  ncm.cbSize = sizeof(NONCLIENTMETRICS);

  VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0));
I used the font's returned from this call for drawing text and this caused the crash.
The problem is that I upgraded to VS2010 and changed the target to WINVER=0x600.
This means that I needed to change my code to the following.

  NONCLIENTMETRICS ncm;
  memset(&ncm, 0, sizeof(NONCLIENTMETRICS));
  ncm.cbSize = sizeof(NONCLIENTMETRICS);
 
#if(WINVER >= 0x0600) 
  OSVERSIONINFO osvi; 
  memset(&osvi,0,sizeof(osvi)); 
  osvi.dwOSVersionInfoSize = sizeof(osvi); 
  GetVersionEx(&osvi); 
  if (osvi.dwMajorVersion < 6) 
    ncm.cbSize -= sizeof(ncm.iPaddedBorderWidth); 
#endif
  VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0));

Note: On windows my application does not actually crash or stop working with my original code and the text is displayed at a size I would kind of expect it to be.
I will raise a bug for this one... as a difference in behaviour.


On 7 October 2011 08:50, Damian Dixon <damian.dixon@gmail.com> wrote:
Thanks for the suggestions.

I've narrowed one of the issues down to WineEngGetGlyphOutline in dlls/gdi32/freetype.c.

The pitch is 6640 and the height is 53003. This means that a buffer of ~335Mb has been allocated and then memset.

This is where the slow down is occurring (because of the memset). I suspect the resultant crash is also because of this.

I would suggest that limits need to be placed on the maximum pitch and height.


I do not however believe that this is the root cause just one of the symptoms. 



On 5 October 2011 18:37, Marcus Meissner <marcus@jet.franken.de> wrote:
On Wed, Oct 05, 2011 at 04:53:18PM +0100, Damian Dixon wrote:
> Hi,
>
> I was attempting to use Wine 1.3.29 (in OpenSUSE 11.4 x86) and because of
> issues pulled the source from git last night and still have problems.
>
> I am having performance issues with DrawText (5 odd seconds to draw a simple
> string) and the occasional X Error and crash.
>
> The X Error is consistent and is as follows:
>
> fixme:advapi:SetSecurityInfo stub
> X Error of failed request:  BadLength (poly request too large or internal
> Xlib length error)
>   Major opcode of failed request:  151 (RENDER)
>   Minor opcode of failed request:  17 (RenderCreateGlyphSet)
>   Serial number of failed request:  41091
>   Current serial number in output stream:  41571
> Process of pid=0023 has terminated
>
>
> The crash less consistent but is dependent upon the amount of text I attempt
> to draw.
>
> The last version I know this worked in was 1.1.39.
>
> I've a few things to still try out before I attempt to create an RBT.

To get a backtrace and be able to dump some datastructures, run with

WINEDEBUG=+synchronous wine foo.exe

This will bring it into the debugger once the condition happens.

CIao, MArcus