Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8124892

Gtk: NullPointerException from com.sun.glass.ui.gtk.GtkApplication.enterNestedEventLoopImpl when using Esc to close modal dialog

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 7u40
    • 7u13
    • javafx
    • Gnome 3.6 on Linux Mint 14 (Ubuntu 12.10 based) with Java 1.7.0_13

      Run the test class provided below and click on the "Open" button to display a modal dialog. The "Close" button in the modal dialog is set as a "Cancel" button and when you use the Esc key in linux to close the dialog the following stack trace is produced. If the dialog button is fired any other way it closes with a stack trace (either by clicking, hitting space while focussed, or using Enter).

      Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
      at com.sun.glass.ui.gtk.GtkApplication.enterNestedEventLoopImpl(Native Method)
      at com.sun.glass.ui.gtk.GtkApplication._enterNestedEventLoop(GtkApplication.java:137)
      at com.sun.glass.ui.Application.enterNestedEventLoop(Application.java:383)
      at com.sun.glass.ui.EventLoop.enter(EventLoop.java:83)
      at com.sun.javafx.tk.quantum.QuantumToolkit.enterNestedEventLoop(QuantumToolkit.java:520)
      at javafx.stage.Stage.showAndWait(Stage.java:397)
      at ModalTest$1.handle(ModalTest.java:26)
      at ModalTest$1.handle(ModalTest.java:1)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:28)
      at javafx.event.Event.fireEvent(Event.java:171)
      at javafx.scene.Node.fireEvent(Node.java:6863)
      at javafx.scene.control.Button.fire(Button.java:179)
      at com.sun.javafx.scene.control.behavior.ButtonBehavior.keyReleased(ButtonBehavior.java:147)
      at com.sun.javafx.scene.control.behavior.ButtonBehavior.callAction(ButtonBehavior.java:117)
      at com.sun.javafx.scene.control.behavior.BehaviorBase.callActionForEvent(BehaviorBase.java:157)
      at com.sun.javafx.scene.control.behavior.BehaviorBase$1.handle(BehaviorBase.java:121)
      at com.sun.javafx.scene.control.behavior.BehaviorBase$1.handle(BehaviorBase.java:119)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:64)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
      at javafx.event.Event.fireEvent(Event.java:171)
      at javafx.scene.Scene$KeyHandler.process(Scene.java:3513)
      at javafx.scene.Scene$KeyHandler.access$2300(Scene.java:3472)
      at javafx.scene.Scene.impl_processKeyEvent(Scene.java:1904)
      at javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:2270)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:136)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:100)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(GlassViewEventHandler.java:163)
      at com.sun.glass.ui.View.handleKeyEvent(View.java:518)
      at com.sun.glass.ui.View.notifyKey(View.java:951)
      at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
      at com.sun.glass.ui.gtk.GtkApplication$3$1.run(GtkApplication.java:82)
      at java.lang.Thread.run(Thread.java:722)


      ****************************** Test Class *****************************************


      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.BorderPane;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Modality;
      import javafx.stage.Stage;


      public class ModalTest extends Application {

      @Override
      public void start(Stage primaryStage) throws Exception {
      final Stage dialog = new Stage();

      primaryStage.setWidth(800);
      primaryStage.setHeight(600);
      primaryStage.centerOnScreen();
      BorderPane stageRoot = new BorderPane();
      Button openButton = new Button("Open");
      openButton.setOnAction( new EventHandler<ActionEvent>() {
      @Override public void handle(ActionEvent event) {
      dialog.showAndWait();
      }
      });
      stageRoot.setTop(openButton);
      primaryStage.setScene(new Scene(stageRoot));
      primaryStage.show();

      dialog.initOwner(primaryStage);
      dialog.initModality(Modality.WINDOW_MODAL);
      StackPane root = new StackPane();
      Button closeButton = new Button("Close");
      closeButton.setOnAction(new EventHandler<ActionEvent>() {
      @Override public void handle(ActionEvent arg0) {
      dialog.hide();
      }
      });
      closeButton.setCancelButton(true);
      closeButton.setDefaultButton(true);
      root.getChildren().add(closeButton);
      dialog.setScene(new Scene(root));
      }

      public static void main(String[] args) {
      launch(args);
         }

      }

            azvegint Alexander Zvegintsev
            csmithjfx Charles Smith (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: