Closed Bug 282867 Opened 20 years ago Closed 20 years ago

Should call ::GdiFlush before trying to read from a DIB section's memory

Categories

(Core Graveyard :: GFX: Win32, defect)

x86
Windows NT
defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: neil, Assigned: neil)

References

()

Details

Attachments

(1 file)

Because of the GDI batch limit it is possible for GDI writes to a DIB section to have been uncompleted before you attempt to read the memory directly. I have examined the win32 code and determined three locations where it appears that a DIB section's memory might be read, and therefore GDI ought to be flushed first. 1. nsDrawingSurfaceWin::Lock might return the memory for mSelectedBitmap 2. nsImageWin::DrawComposited reads screenBits after setting them with BitBlt 3. nsImageWin::DrawTile reads screenBits after setting them with SretchBlt Note that there is no issue with writing to a DIB section before calling a GDI function, or passing DIB section raw memory buffers to GDI functions.
Attached patch Proposed patchSplinter Review
Assignee: win32 → neil.parkwaycc.co.uk
Status: NEW → ASSIGNED
Attachment #174997 - Flags: superreview?(darin)
Attachment #174997 - Flags: review?(emaijala)
Hmm... actually the docs suggest that you can't even call SetDIBits...
Comment on attachment 174997 [details] [diff] [review] Proposed patch I presume that you were not able to actually demonstrate the problem, correct? Also, what is the default batch limit? It does not appear that we ever set the batch limit.
Attachment #174997 - Flags: superreview?(darin) → superreview+
The default batch limit appears to be 1 for Windows 9x/Me and 20 for NT class operating systems, although NT often flushes the batch before the limit.
Oh, I was able to demonstrate case 2, which is what led me to file this bug.
ok, sounds good.
Comment on attachment 174997 [details] [diff] [review] Proposed patch r=emaijala on this good thing
Attachment #174997 - Flags: review?(emaijala) → review+
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: