Module: wine Branch: refs/heads/master Commit: d5292cb3f43c882d46e8a83475b047edec0ea633 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=d5292cb3f43c882d46e8a834...
Author: Dan Kegel dank@kegel.com Date: Sun Apr 9 14:47:21 2006 -0700
x11drv: Fix two clipboard bugs.
Fix two clipboard problems that caused BadAtom crashes and caused some clipboard formats to not be exported properly.
---
dlls/x11drv/clipboard.c | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/dlls/x11drv/clipboard.c b/dlls/x11drv/clipboard.c index 567edd9..49a7ccc 100644 --- a/dlls/x11drv/clipboard.c +++ b/dlls/x11drv/clipboard.c @@ -1784,6 +1784,10 @@ static VOID X11DRV_CLIPBOARD_InsertSelec if (names) { wine_tsx11_lock(); + /* FIXME: we're at the mercy of the app sending the event here. + * Currently if they send a bogus atom, we will crash. + * We should handle BadAtom errors gracefully in this call. + */ XGetAtomNames( display, atoms, nb_atoms, names ); wine_tsx11_unlock(); for (i = 0; i < nb_atoms; i++) @@ -2790,6 +2794,13 @@ static Atom X11DRV_SelectionRequest_TARG LPWINE_CLIPFORMAT lpFormats; LPWINE_CLIPDATA lpData;
+ /* Create X atoms for any clipboard types which don't have atoms yet. + * This avoids sending bogus zero atoms. + * Without this, copying might not have access to all clipboard types. + * FIXME: is it safe to call this here? + */ + intern_atoms(); + /* * Count the number of items we wish to expose as selection targets. */ @@ -2804,7 +2815,7 @@ static Atom X11DRV_SelectionRequest_TARG while (lpFormats) { if ((lpFormats->wFormatID == lpData->wFormatID) && - lpFormats->lpDrvExportFunc) + lpFormats->lpDrvExportFunc && lpFormats->drvData) cTargets++;
lpFormats = lpFormats->NextFormat; @@ -2832,7 +2843,7 @@ static Atom X11DRV_SelectionRequest_TARG while (lpFormats) { if ((lpFormats->wFormatID == lpData->wFormatID) && - lpFormats->lpDrvExportFunc) + lpFormats->lpDrvExportFunc && lpFormats->drvData) targets[i++] = lpFormats->drvData;
lpFormats = lpFormats->NextFormat; @@ -2849,12 +2860,9 @@ static Atom X11DRV_SelectionRequest_TARG unsigned int i; for ( i = 0; i < cTargets; i++) { - if (targets[i]) - { - char *itemFmtName = XGetAtomName(display, targets[i]); - TRACE("\tAtom# %d: Property %ld Type %s\n", i, targets[i], itemFmtName); - XFree(itemFmtName); - } + char *itemFmtName = XGetAtomName(display, targets[i]); + TRACE("\tAtom# %d: Property %ld Type %s\n", i, targets[i], itemFmtName); + XFree(itemFmtName); } }