> On 12 Jan 2017, at 20:09 , <
[hidden email]> <
[hidden email]> wrote:
>
> Hi,
>
> I am trying to work the tutorial provided on the GL website using SWT.
>
> However, when working through the chapter <Multithreading our
> IssuesBrowser> I always run into a deadlock calling
> GlazedListsSWT.eventTableViewerWithThreadProxyList.
>
> Here is a stripped down version of the code:
> private void createComposite(Shell shell)
> {
> Composite composite = new Composite(shell, SWT.NONE);
> GridLayoutFactory.fillDefaults().applyTo(composite);
>
> sortedList.getReadWriteLock().readLock().lock(); // removing this
> line resolves the issue as well
>
> try
> {
> TableViewer tableViewer = new TableViewer(composite);
>
> DefaultEventTableViewer<Issue> issueTableModel =
> GlazedListsSWT.eventTableViewerWithThreadProxyList(
> sortedList,
> tableViewer.getTable(),
> createTableFormat());
>
> GridDataFactory.fillDefaults().grab(true,
> true).applyTo(tableViewer.getTable());
> } finally
> {
> sortedList.getReadWriteLock().readLock().unlock();
> }
> }
>
> The method call to GlazedListsSWT.eventTableViewerWithThreadProxyList
> runs into the deadlock calling DefaultEventTableViewer(...)which tries
> to lock the proxy list it created just beforehand:
>
> public static <E> DefaultEventTableViewer<E>
> eventTableViewerWithThreadProxyList(EventList<E> source, Table table,
> TableFormat<? super E> tableFormat) {
> final EventList<E> proxySource =
> createSwtThreadProxyListWithLock(source, table.getDisplay());
> return new DefaultEventTableViewer<E>(proxySource, table,
> tableFormat, TableItemConfigurer.DEFAULT, true);
> }
>
> DefaultEventTableViewer(EventList<E> source, Table table, TableFormat<?
> super E> tableFormat, TableItemConfigurer<? super E>
> tableItemConfigurer, boolean disposeSource)
> {
> ...
> source.getReadWriteLock().writeLock().lock(); // this is where
> the deadlock occurs.
> ...
> }
>
> Is this a bug or am I doing something wrong? I am at a loss here.
>
> The Swing examples work as well. However, the code differs and the
> proxy list is not being locked which apparently is not necessary. It
> just executes:
> protected DefaultEventTableModel(EventList<E> source, boolean
> disposeSource, TableFormat<? super E> tableFormat) {
> this.source = source;
> this.disposeSource = disposeSource;
> this.tableFormat = tableFormat;
> source.addListEventListener(this);
> }
>
> Cheers