Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#10446 closed defect (wontfix)

Large drawing coordinates hang wxMSW requiring hard reset.

Reported by: stambaughw Owned by:
Priority: critical Milestone:
Component: wxMSW Version: 2.8.9
Keywords: wxMSW Cc:
Blocked By: Blocking:
Patch: no


There appears to be a bug in the drawing code that hangs Windows hard requiring a hardware reset clear when using large drawing coordinates. This bug does not appear effect wxGTK. To duplicate the bug modify line 1268 of the drawing sample in wxWidgets 2.8.9 from:

DrawTestLines( 0, 760, 6, dc );


DrawTestLines( 0x90000, 760, 6, dc );

Build and run the sample and scroll down to the bottom of the canvas. Stepping through the code with a debugger doesn't seem to reveal a lot of information due to OnPaint constantly being called. However, the hard lock is prevented and stepping through the Windows GDI MoveToEx and LineTo functions don't lock up the system. Maybe an event loop problem? I am no expert in this area but I am willing to provide any addition information as required.

I have confirmed this on Windows XP SP3 using both MinGW with GCC 3.4.5 and Visual Studio 2005 using wxWidgets 2.8.9. I also confirmed that this behavior does not exist on wxGTK on Debian Testing (Lenny) with wxWidgets 2.8.7 and GCC 4.3.2.

Change History (8)

comment:1 Changed 11 years ago by vadz

  • Status changed from new to infoneeded_new

Have you tested the same binary on another machine, preferably with a different video card (or even on the same machine with "standard SVGA" video driver)? It really looks like a video driver bug, wx should be unable to do anything requiring hardware reset whatever we do.

comment:2 Changed 11 years ago by stambaughw

I personally did not find the problem. Another developer discovered it. I just duplicated it and verified that it wasn't a problem on wxGTK using the same hardware. It seems unlikely (although possible) that he and I have the exact same hardware and drivers. I produced the error on a system using an nVidia 7300GS video card with driver version 178.13. I have an all Intel laptop at home. I'll verify the if the problem exists there get you an update as soon as I can.

comment:3 Changed 11 years ago by stambaughw

  • Status changed from infoneeded_new to new

Duplicated error on Intel 82945G express graphics chipset with driver version It appears to be a problem with either wxMSW or the Windows GDI.

comment:4 Changed 11 years ago by stambaughw

Error duplicated on the following hardware:

ATI Radeon 7000
S3 VIA chrome 9 HC IGP
Intel Q965/Q963 express chipset family on Dell Optoplex 745

comment:5 Changed 11 years ago by vadz

  • Status changed from new to confirmed

Amazing, I can even reproduce the problem in a VM. It really looks like a (bad) Windows bug. I couldn't debug it yet but I still don't think it's really a wx bug as nothing done by the user code should be able to freeze the system like this. But we still need to understand what exactly is the problem.

comment:6 Changed 11 years ago by munnin

  • Status changed from confirmed to infoneeded_new

I had a look at the example. The problem is not related with graphic cards, but seems to be inherent to Windows GDI.

The offending code is:
dc.SetPen( wxPen( wxT("black"), width, wxDOT) );
dc.DrawLine( x+20, y+30, 100, y+30 );

The system doesn't actually hang, but it is locked while the line is drawn. I guess that the dot calculation takes so long.

This is easily reproducable:

  • Edit MyCanvas::DrawTestLines() so that only the code above is executed.
  • Increase x in 10000 steps.
  • You will see the "drawing" (i.e. hanging) takes longer and longer.

Not sure wxWidget can or should do anything about this GDI "bug". That's why I didn't close the ticket.

comment:7 Changed 11 years ago by vadz

  • Resolution set to wontfix
  • Status changed from infoneeded_new to closed

Thanks a lot for taking time to test and debug this!

I agree that there doesn't seem anything we can do here -- the only idea would be to impose some kind of checks on the coordinates but this would necessarily be arbitrary and so doesn't look like a good idea.

I'm tentatively closing it as I don't see what [else] could we do, even in theory, to work around it, please reopen if you have any suggestions.

And thanks again to munnin!

comment:8 Changed 11 years ago by stambaughw

Your certainly welcome. Just trying to make the world a better place one bug at a time. Thank for taking your time to look into it. I just wish the bug could have been resolved within wxWidgets. It effects the Kicad project in some rare corner cases. I may get motivated and forward this information to Microsoft. Although I don't expect any resolution.

Note: See TracTickets for help on using tickets.