Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 288491

Summary: [Widgets] JVM crash after TableViewer.setItemCount(int)
Product: [Eclipse Project] Platform Reporter: Andreas Nusser <a.nusser>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WORKSFORME QA Contact: Bogdan Gheorghe <gheorghe>
Severity: major    
Priority: P3 CC: ericwill, pinnamur
Version: 3.5Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Plug-in to reproduce the crash none

Description Andreas Nusser CLA 2009-09-03 11:07:44 EDT
Created attachment 146408 [details]
Plug-in to reproduce the crash

We have a fairly easy to reproduce bug which causes the JVM to crash.
To do so, create a view with a tableviewer and use the ILazyContentProvider as
content provider. Then let the updateElement(int) method of the content
provider call viewer.setItemCount(x) instead of viewer.replace(object,int).

The system we use is a Ubuntu 9.04 (all updates installed), with Eclipse 3.5
(all updates installed).
It is not possible to reproduce the crash with Windows.

Here is the code snippet which causes the crash:

    public void createPartControl(Composite parent) {
        viewer = new TableViewer(parent, SWT.VIRTUAL | SWT.H_SCROLL |
SWT.V_SCROLL);
        viewer.setContentProvider(this);
        viewer.setLabelProvider(new ViewLabelProvider());
        viewer.setInput(getViewSite());
        viewer.setItemCount(50);
    }

    @Override
    public void updateElement(int index) {
        if(index < 10){
            viewer.replace("Eelement " + index, index);    
        }else{
            viewer.setItemCount(index);
        }        
    }


Find the complete plug-in source attached.

The log file holds the following information:

---------------  T H R E A D  ---------------

Current thread (0x0843c400):  JavaThread "main" [_thread_in_native, id=5310,
stack(0xb74db000,0xb752c000)]

siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR),
si_addr=0x00000000

Registers:
EAX=0x852adfb4, EBX=0x83b5868c, ECX=0x00000001, EDX=0x852adfb4
ESP=0xb7528808, EBP=0xb7528838, ESI=0x00000000, EDI=0x852adfb4
EIP=0xb7e7131d, CR2=0x00000000, EFLAGS=0x00010646

Top of Stack: (sp=0xb7528808)
0xb7528808:   b7528854 83b56ae3 852adfb4 00000000
0xb7528818:   00000004 83b56a83 00000001 b7528824
0xb7528828:   00000000 a5b81ed8 b752885c 0843c400
0xb7528838:   b7528868 b547e060 0843c510 b752885c
0xb7528848:   b7528854 00000000 00000004 852adfa8
0xb7528858:   b7528858 a5b82738 b7528888 a5b85810
0xb7528868:   b75288b0 b52d704d 00000004 b7528888
0xb7528878:   b75288b0 b52d6f29 b52d704d 00000004 

Instructions: (pc=0xb7e7131d)
0xb7e7130d:   01 83 ee 01 d1 e9 73 02 66 a5 83 ef 02 83 ee 02
0xb7e7131d:   f3 a5 89 d6 8b 44 24 08 fc 5f c3 90 90 90 90 90 

Stack: [0xb74db000,0xb752c000],  sp=0xb7528808,  free space=310k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libc.so.6+0x7931d]  memmove+0x4d
J  org.eclipse.swt.internal.C.memmove([III)V
j  org.eclipse.swt.widgets.Table.cellDataProc(IIIII)I+31
j  org.eclipse.swt.widgets.Display.cellDataProc(IIIII)I+24
Comment 1 Alexander Kurtakov CLA 2017-01-05 18:17:59 EST
Is this bug still reproducible? The snippet is not runnable directly.
Comment 2 Eric Williams CLA 2017-06-30 10:30:00 EDT
No response in awhile, going to close this for now. If the issue re-appears, please provide a snippet to reproduce the issue.