| Ticket UUID: | f96c6eb36bcbd6c59101293af4d60e92230f5981 | |||
| Title: | Tk panics with large number of images on Windows | |||
| Type: | Bug | Version: | 9.0.b2 | |
| Submitter: | obermeier | Created on: | 2024-06-10 20:10:17 | |
| Subsystem: | 41. Photo Images | Assigned To: | nobody | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Open | Last Modified: | 2024-06-12 08:47:03 | |
| Resolution: | None | Closed By: | nobody | |
| Closed on: | ||||
| Description: |
When creating a large amount of images (> 4000) and attaching to a label, Tk panics on Windows: Fail to create pixmap with Tk_GetPixmap in TkImgPhotoInstanceSetSize Happens with 8.6.14 as well as 9.0b2. The supplied test script works on Linux. | |||
| User Comments: |
oehhar added on 2024-06-12 08:47:03:
Thanks for the analysis. Maybe, the issue is somewhere else and we only see the resulting symtoms here. The GetDC man page https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc only states, that it may fail if the DC is taken somewhere else. So, it might be that a drawing function call somewhere else fails and that this does not release the dc. Thank you, Harald fvogel added on 2024-06-11 22:24:33: What is weird is that if I use -width 1000 -height 1000 instead of -width 100 -height 100, it works up to exactly the same number of iterations (while allocating much much more memory). Same thing with -width 10 -height 10. So this must not be a problem of available memory allocation. fvogel added on 2024-06-11 21:58:50:
Actually, it's the call to fvogel added on 2024-06-11 21:33:24: The call to CreateBitmap() returns NULL with GetLastError() returning 0x0 (Success!). The call to CreateDIBSection() returns NULL with GetLastError() returning 0x57 (ERROR_INVALID_PARAMETER). oehhar added on 2024-06-11 09:17:51: The "CreateBitmap" manpage https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-createbitmap does not document any resource issues and no graphic card dependency. The "CreatedDIB" manpage https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-createdibsection neither. But apparently, the limits apply for both of them. On a quick search I did not find anything about it. It would be great to get the last windows error core after the NULL return. THanks, Harald fvogel added on 2024-06-11 03:52:14: The problem happens here. The call to CreateBitmap() line 66 returns NULL, which is handled by the immediately following section (see the comments there) by trying CreateDIBSection(). That call also fails (returns NULL), a message box should be posted (but I'm not seeing it), and NULL is returned, leading in turn in the reported panic in TkImgPhotoInstanceSetSize(). The fallback code was introduced in [427ac9fc] to fix bug [2080533]. | |||
Attachments:
- imgcreatebug.tcl [download] added by obermeier on 2024-06-10 20:10:56. [details]
