[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: SWTException in ColumnViewerEditor.activateCellEditor
|
But what are you disposing? Hopefully not the CellEditor because you
should create it once and reuse it all over. There's by definition
always only one CellEditor active.
Please modify one of our snippets so I can take a look what you are
doing and how one can solve it. You should by the way not delay the
model update but the disposing if you dispose something => don't dispose
the CellEditor!
Tom
Florin Mateoc schrieb:
> Tom,
>
> Thank you for your reply. It was a bit of a rhetorical question, meaning that, given that the documentation is pretty
> thin, we should at least be able to use the sources as documentation.
>
> Anyway, I think this lack of support for disposing is a bit of a problem. I don't think that in this situation delaying
> the refresh is a solution.
>
> To give a little more detail: the two cells are in the same row, i.e. they belong to the same instance of TreeItem.
> The use case is: I make a modification in one cell with the mouse (it is a radiobuttonset cell) and then I click with
> the mouse on the other cell. It is only during the new cell's editor activation that the contents of the modified cell
> is applied. The modification should change both the model and the treeItem. But if we delay the modification of the
> treeItem, it means that we create and open a cell editor on stale data.
>
> I hope I am missing something,
>
> Florin
>
>
> Tom Schindl wrote:
>> Hi,
>>
>> I can't give you the reason. It might be that this code is in since a
>> very very long time.
>>
>> Tom
>>
>> Florin Mateoc schrieb:
>>> Tom Schindl wrote:
>>>> We don't support disposing, event-loop spinning, .... while the
>>>> JFace-Code is running! You should defer the disposal using
>>>> Display#asyncExec().
>>>>
>>>> Tom
>>>>
>>> Then why does the code in applyEditorValue() check for isDisposed()?
>>>
>>> Florin
>>>
>>>
>>>> Florin Mateoc schrieb:
>>>>> Hi all,
>>>>>
>>>>> I get a "Widget is disposed" exception in
>>>>> ColumnViewerEditor.activateCellEditor(ColumnViewerEditorActivationEvent),
>>>>>
>>>>> when executing the line:
>>>>>
>>>>> this.cell.getItem().addDisposeListener(disposeListener);
>>>>>
>>>>> After investigating a bit, the disposal happens while executing the
>>>>> method handleEditorActivationEvent(ColumnViewerEditorActivationEvent),
>>>>> inside the applyEditorValue() call. At that time, the cell was already
>>>>> retrieved and stored as the source of the event, and it continues to be
>>>>> used in handleEditorActivationEvent, although the call to
>>>>> applyEditorValue can obviously (and does) modify the tree.
>>>>>
>>>>> In my case, the disposal happens inside the call to
>>>>> saveEditorValue(CellEditor) called from applyEditorValue. If I look at
>>>>> the code in applyEditorValue, it seems to expect tree modification,
>>>>> since it has tests for isDisposed() all around, so I assume this is a
>>>>> bug. I think it could be fixed easily be replacing the line:
>>>>>
>>>>> this.cell = (ViewerCell) event.getSource();
>>>>>
>>>>> from handleEditorActivationEvent(ColumnViewerEditorActivationEvent) with
>>>>> something like:
>>>>>
>>>>> this.cell = viewer.getCell(new Point(event.sourceEvent.x,
>>>>> event.sourceEvent.y));
>>>>>
>>>>> in order to get the potentially updated cell instead of the stale one.
>>>>>
>>>>> If I missed something, please don't hesitate to point it out.
>>>>> Thank you,
>>>>>
>>>>> Florin
>>
--
B e s t S o l u t i o n . at
--------------------------------------------------------------------
Tom Schindl JFace-Committer
--------------------------------------------------------------------