[Bug 3907] New: Crash in extFloodFill after a resize event.

Wine Bugs wine-bugs at winehq.org
Mon Nov 21 18:46:35 CST 2005


http://bugs.winehq.org/show_bug.cgi?id=3907

           Summary: Crash in extFloodFill after a resize event.
           Product: Wine
           Version: 0.9.1.
          Platform: PC
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: wine-gdi-(printing)
        AssignedTo: wine-bugs at winehq.org
        ReportedBy: andrew7webb at comcast.net


PROBLEM:
extFloodFill crashes.   
It can work, but as soon as the window is resized, it will crash every time.
I isolated the problem from the canvas sample code of Smartwin++.

OS is Xandros.

OUTPUT OF PROGRAM:
wine canvas.exe.so
fixme:system:SystemParametersInfoW Unimplemented action: 4159 (SPI_SETUIEFFECTS)
extFloodFill( 190, 5 ... ) done.
extFloodFill( 190, 5 ... ) done.
    [I resized the window horizontally at this point]
extFloodFill( 188, 5 ... )X Error of failed request:  BadMatch (invalid
parameter attributes)
  Major opcode of failed request:  73 (X_GetImage)
  Serial number of failed request:  266
  Current serial number in output stream:  266

Note that the "done" did not appear on the third call to extFloodFill, but the
crash info did.  The code area that crashed is:

std::cout << "extFloodFill( " << x4 << ", " << y + 5 << " ... )";
c.extFloodFill( x4, y + 5, color, false );
std::cout << " done." << std::endl;


The canvas class's implementation of extFlodFill is just a wrapper around the
WIN32 gdi call:

bool Canvas::extFloodFill( int x, int y, COLORREF color, bool fillTilColorFound )
{
return ::ExtFloodFill( itsHdc, x, y, color,
fillTilColorFound?FLOODFILLBORDER:FLOODFILLSURFACE ) != FALSE;
}

So it will fill while we find the color.  FLOODFILLSURFACE


COMPLETE SOURCE OF PROGRAM:
/*	A demonstration of the use of SmartWin::PaintCanvas and UpdateCanvas.
*/
#include "SmartWin.h"
using namespace SmartWin;

#include <iostream>

class CanvasWidget
	: public WidgetFactory< WidgetWindow, CanvasWidget >
{
	//WidgetMenuPtr ptrSysMenu;
	WidgetMenuPtr ptrMainMenu;
public:
	void init( )
	{
		createWindow( );

		setText( _T("Crash while doing extFloodFill after resize.") );
		onSized( &CanvasWidget::isResized );

		thecolor = 0x0000FFFF; // Defaulting to yellow...

		onPainting( &CanvasWidget::painting );
		updateWidget();
	}
	

private:
	COLORREF thecolor;

	COLORREF RandColor()
	{
		return( RGB( rand()%255, rand()%255, rand()%255 ) );
	}

	void painting( SmartWin::Canvas & c )
	{
		// rc.pos is the upper left point, rc.size is the lower right point.
		SmartWin::Rectangle rc( getClientAreaSize() );

		// Divide the dimensions into halves, quarters and eighths
		int x1= rc.size.x, x2= x1/2, x4= x2/2, x8= x4/2,
			y1= rc.size.y, y2= y1/2, y4= y2/2, y8= y4/2;

		// Use this color until pen and brush goes out of scope.
		SmartWin::Pen  pen( c, thecolor );
		SmartWin::Brush  brush( c, thecolor );

		// Use the existing background for text 

		c.setBkColor( c.getPixel( 0,y2 ) );

		// Do a number of Graphics operations, and show the calls

		int	items=2;

		int spacing = 10;
		int yinc = ( y1 -( items * spacing ) ) / items;
	
		int x = 0;
		int y = 0;

		// Draw the same triangle, and then fill it with our color.
		c.line( 0, y,  x2, y );
		c.lineTo( x4, y + yinc );
		c.lineTo( 0, y );

		COLORREF color = c.getPixel( x4, y+5);
		c.extTextOut( _T(" c.extFloodFill( x4, y+5, color, false );"), x2, y );
		std::cout << "extFloodFill( " << x4 << ", " << y + 5 << " ... )";
		c.extFloodFill( x4, y + 5, color, false );	// Fill while we find the color. 
FLOODFILLSURFACE
		std::cout << " done." << std::endl;
		y += yinc + spacing;
	}


	// There are new dimensions to the window because the user resized the window.
	void isResized( const SmartWin::WidgetSizedEventResult & sz )
	{
		updateWidget();
	}

};


// Application entry point just like all other SmartWin applications...
int SmartWinMain( Application & app )
{
	CanvasWidget * cw = new CanvasWidget();	cw->init();
	return( app.run() );
}

________________________________

HOW TO BUILD IT:
See bug ID 3900
and just replace Main.cpp with the above source.
Or build the the Canvas sample.

best regards,
Andrew Webb

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the wine-bugs mailing list