bugKawa - Bugs: bug #12105, Can't call out from...

 
 

bug #12105: Can't call out from define-simple-class methods on Swing thread

Submitter:  Steve Yegge <stevey>
Submitted:  Wed 23 Feb 2005 05:57:30 AM UTC
   
 
Category:  Scheme language Severity:  3 - Normal
Item Group:  Run-time exception Status:  Fixed
Privacy:  Public Assigned to:  bothner
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 24 Mar 2005 04:15:43 AM UTC, comment #2: 

As Jim writes, it seems to work now.

Per Bothner <bothner>
Group administrator
Thu 24 Mar 2005 03:35:48 AM UTC, comment #1: 

The change to gnu.mapping.CallContext on 2-24-2005 seems to have fixed this.

Jim White <jimwhite>
Wed 23 Feb 2005 05:57:30 AM UTC, original submission:  

If you try to call an ordinary function from a member
function (latest CVS sources) on a thread other than
the main thread, you get a NullPointerException;
Environment.global is null.

The easiest way to see this is with a little Swing app:

#!/usr/bin/env kawa

(define (draw-board g :: <java.awt.Graphics>)
 (display "hi"))

(define-simple-class <SokoPanel> (<javax.swing.JPanel>)
 ((update g :: <java.awt.Graphics>) :: <void>
  (invoke (this) 'paint g))
 ((paint g :: <java.awt.Graphics>) :: <void>
  (draw-board g)))

(let ((frame (make <javax.swing.JFrame> "test")))
 (let ((root (invoke frame 'getContentPane)))
   (invoke root 'add (make <SokoPanel>)))
 (invoke frame 'setSize 300 300)
 (invoke frame 'setDefaultCloseOperation
         (static-field <javax.swing.WindowConstants> 'EXIT_ON_CLOSE))
 (invoke frame 'setVisible #t))

(The size and close op are just there so you can easily
kill the app after the exception, but are otherwise
irrelevant.)

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at gnu.mapping.ThreadLocation.getLocation(ThreadLocation.java:70)
at gnu.mapping.ThreadLocation.get(ThreadLocation.java:103)
at gnu.mapping.Location.get(Location.java:65)
at SokoPanel.paint(test.scm:10)
at javax.swing.JComponent.paintChildren(JComponent.java:840)
at javax.swing.JComponent.paint(JComponent.java:1012)
at javax.swing.JComponent.paintChildren(JComponent.java:840)
at javax.swing.JComponent.paint(JComponent.java:1012)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:559)
at javax.swing.JComponent.paintChildren(JComponent.java:840)
at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4937)
at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4883)
at javax.swing.JComponent.paint(JComponent.java:993)
at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)
at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
at java.awt.Container.paint(Container.java:1709)
at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
at sun.awt.RepaintArea.paint(RepaintArea.java:224)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:254)
at java.awt.Component.dispatchEventImpl(Component.java:4031)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Window.dispatchEventImpl(Window.java:1766)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

This is a blocking issue with no apparent workaround.

Steve Yegge <stevey>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follow 3 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-03-24 bothner StatusNone Fixed
    Assigned toNone bothner
    Open/ClosedOpen Closed

Back to the top

Powered by Savane 3.13-4b48.
Corresponding source code