Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 335613 - Infinite loop after setFocus / screensaver interaction
Summary: Infinite loop after setFocus / screensaver interaction
Status: CLOSED DUPLICATE of bug 329872
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6.1   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-27 15:44 EST by Greg Smith CLA
Modified: 2011-02-04 13:03 EST (History)
2 users (show)

See Also:


Attachments
Apple crash report showing infinite loop in SWT (1.31 MB, text/rtf)
2011-01-27 15:48 EST, Greg Smith CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Smith CLA 2011-01-27 15:44:59 EST
Build Identifier: 3.6.1.v3655c

Our Eclipse based application was running when the screen saver on Mac OS X locked after a couple of minutes of activity.

When the user came back, and unlocked the screensaver, the application crashed with a Apple crash report.  When looking at the crash report, its clear that there is a never ending loop in the stack, that looks like this:

j  org.eclipse.swt.internal.carbon.OS.SelectWindow(I)V+0
j  org.eclipse.swt.widgets.Shell.setActive()V+16
j  org.eclipse.swt.widgets.Shell.bringToTop(Z)V+20
j  org.eclipse.swt.widgets.Control.forceFocus()Z+60
j  org.eclipse.swt.widgets.Control.setTabItemFocus()Z+10
j  org.eclipse.swt.widgets.Control.setTabGroupFocus()Z+1
j  org.eclipse.swt.widgets.Control.traverseGroup(Z)Z+93
j  org.eclipse.swt.widgets.Shell.kEventWindowActivated(III)I+169
J  org.eclipse.swt.widgets.Widget.windowProc(III)I
J  org.eclipse.swt.widgets.Display.windowProc(III)I
v  ~StubRoutines::call_stub
j  org.eclipse.swt.internal.carbon.OS.SelectWindow(I)V+0
j  org.eclipse.swt.widgets.Shell.setActive()V+16
j  org.eclipse.swt.widgets.Shell.bringToTop(Z)V+20
j  org.eclipse.swt.widgets.Control.forceFocus()Z+60
j  org.eclipse.swt.widgets.Control.setTabItemFocus()Z+10
j  org.eclipse.swt.widgets.Control.setTabGroupFocus()Z+1
j  org.eclipse.swt.widgets.Control.traverseGroup(Z)Z+93
j  org.eclipse.swt.widgets.Shell.kEventWindowActivated(III)I+169
J  org.eclipse.swt.widgets.Widget.windowProc(III)I
J  org.eclipse.swt.widgets.Display.windowProc(III)I
v  ~StubRoutines::call_stub

This is repeated 100s of times.  

The root cause, at the very bottom of the stack, is a call to setFocus() on the Window.

The problem is intermittent -- and not easy to reproduce.

The Apple crash stack will be attached.

Reproducible: Always

Steps to Reproduce:
Difficult to reproduce, but the application crash stack has been recorded.

To reproduce, setFocus must be called at exactly the correct time as when the screensaver is locking.
Comment 1 Greg Smith CLA 2011-01-27 15:48:41 EST
Created attachment 187775 [details]
Apple crash report showing infinite loop in SWT

Apple crash report showing infinite loop in SWT
Comment 2 Scott Kovatch CLA 2011-02-04 13:03:10 EST
Amazingly enough, this is the same problem we're fixing in bug 329872. Calling SelectWindow, presumably when the application is not currently active, leads to an infinite loop.

That might be a better fix than the one I wrote, but in any event the stack is the same.

*** This bug has been marked as a duplicate of bug 329872 ***