mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +03:00 
			
		
		
		
	If the clipboard fails to open on Windows, wait and try again
This commit is contained in:
		
							parent
							
								
									2a274a4760
								
							
						
					
					
						commit
						f67fcf131a
					
				| 
						 | 
				
			
			@ -437,8 +437,14 @@ PyImaging_GrabClipboardWin32(PyObject *self, PyObject *args) {
 | 
			
		|||
    LPCSTR format_names[] = {"DIB", "DIB", "file", "png", NULL};
 | 
			
		||||
 | 
			
		||||
    if (!OpenClipboard(NULL)) {
 | 
			
		||||
        PyErr_SetString(PyExc_OSError, "failed to open clipboard");
 | 
			
		||||
        return NULL;
 | 
			
		||||
        // Maybe the clipboard is temporarily in use by another process.
 | 
			
		||||
        // Wait and try again
 | 
			
		||||
        Sleep(500);
 | 
			
		||||
 | 
			
		||||
        if (!OpenClipboard(NULL)) {
 | 
			
		||||
            PyErr_SetString(PyExc_OSError, "failed to open clipboard");
 | 
			
		||||
            return NULL;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // find best format as set by clipboard owner
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user