Class ClipboardProxy

java.lang.Object
org.eclipse.swt.dnd.ClipboardProxy

class ClipboardProxy extends Object
Clipboard proxy used to copy data to the clipboard in GTK3 only
See Also:
  • Field Details

    • clipboardData

      Object[] clipboardData
    • clipboardDataTypes

      Transfer[] clipboardDataTypes
    • primaryClipboardData

      Object[] primaryClipboardData
    • primaryClipboardDataTypes

      Transfer[] primaryClipboardDataTypes
    • clipboardOwner

      long clipboardOwner
    • display

      Display display
      display == null means that the display has been disposed.
    • activeClipboard

      Clipboard activeClipboard
    • activePrimaryClipboard

      Clipboard activePrimaryClipboard
    • getFunc

      Callback getFunc
    • clearFunc

      Callback clearFunc
    • ID

      static String ID
  • Constructor Details

    • ClipboardProxy

      private ClipboardProxy(Display display)
  • Method Details

    • _getInstance

      static ClipboardProxy _getInstance(Display display)
    • clear

      void clear(Clipboard owner, int clipboards)
    • gtk_gdk_clipboard_clear

      void gtk_gdk_clipboard_clear(long clipboard)
    • finishDispose

      private void finishDispose()
      The calls to gtk_clipboard_set_with_owner (in setData(Clipboard, Object[], Transfer[], int)) means the GtkClipboard (in C side) has function pointers saved to the getFunc + clearFunc callbacks. Therefore, when we dispose ClipboardProxy we cannot dispose the callbacks until we know that GtkClipboard doesn't have a pointer to these callbacks. GtkClipboard clears these pointers in clipboard_unset (https://gitlab.gnome.org/GNOME/gtk/-/blob/716458e86a222f43e64f7a4feda37749f3469ee4/gtk/gtkclipboard.c#L755) and notifies us that the pointers are no longer stored by calling clearFunc (https://gitlab.gnome.org/GNOME/gtk/-/blob/716458e86a222f43e64f7a4feda37749f3469ee4/gtk/gtkclipboard.c#L782) Therefore, after disposing ClipboardProxy we need to defer disposing the callbacks until clearFunc has been called. We know if we have been called sufficiently (for both clipboards that could have a handle stored) when both clipboards no longer have data stored. If we don't defer the disposal it causes SIGSEGV or other undefined behavior. Fix for https://github.com/eclipse-platform/eclipse.platform.swt/issues/2675
    • clearFunc

      long clearFunc(long clipboard, long user_data_or_owner)
    • dispose

      void dispose()
    • getFunc

      long getFunc(long clipboard, long selection_data, long info, long user_data_or_owner)
      This function provides the data to the clipboard on request. When this clipboard is disposed, the data will no longer be available.
    • setData

      boolean setData(Clipboard owner, Object[] data, Transfer[] dataTypes, int clipboards)