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

When repeating PopupControl.show and hide, XID collision messages appears

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      DELL OPTIPLEX 7010
      Ubuntu 18.04 amd64
      JDK 1.8.0_191

      A DESCRIPTION OF THE PROBLEM :
      When repeating PopupControl.show and hide, XID collision messages appear. Attached the simple program that reproduces the issue.

      I know a similar issue has been reported in other OSS project; https://bugs.freedesktop.org/show_bug.cgi?id=21583. But I think that this issue should be tracked, in order to clarify where the root cause of this particular issue is and provide a workaround if possible.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1) Compile sample/Main.java and sample/PopupTest.java
         % javac -d . sample/*java
      2) Run sample.Main
         % java sample.Main
      3) Click the button and wait for a while

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No warning message is shown.
      ACTUAL -
      The following line is shown a lot of times.

      (java:14329): Gdk-WARNING **: 19:35:46.301: XID collision, trouble ahead


      ---------- BEGIN SOURCE ----------
      == sample/Main.java ==
      package sample;

      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Group;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.stage.Stage;
      import javafx.stage.Window;

      public class Main extends Application {

          PopupTest popup = new PopupTest();

          @Override
          public void start(Stage stage) throws Exception {
              Group root = new Group();
              final Scene scene = new Scene(root);
              scene.getStylesheets().add(Main.class.getResource("style.css").toExternalForm());

              final Button button = new Button("show popup");
              button.setOnAction(new EventHandler<ActionEvent>() {
                  @Override
                  public void handle(ActionEvent event) {
      Window window = scene.getWindow();
                      for (int i = 0; i < 100000; i++) {
                          popup.hide();
                          popup.show(window);
                      }
                  }
              });
              root.getChildren().add(button);
              stage.setScene(scene);
              stage.show();
          }

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

      == sample/PopupTest.java ==
      package sample;

      import javafx.scene.control.Label;
      import javafx.scene.control.PopupControl;
      import javafx.scene.layout.StackPane;
      import javafx.scene.shape.Rectangle;

      public class PopupTest extends PopupControl {
          public PopupTest() {
              getStyleClass().add("popup");
              StackPane pane = new StackPane();
              pane.getStyleClass().add("pane");
              Rectangle rectangle = new Rectangle(250, 250);
              rectangle.getStyleClass().add("rect");
              Label text = new Label("popup test");
              text.getStyleClass().add("text");
              pane.getChildren().addAll(rectangle, text);
              getScene().setRoot(pane);
          }
      }

      == sample/sample.fxml ==
      <?import javafx.geometry.Insets?>
      <?import javafx.scene.layout.GridPane?>

      <?import javafx.scene.control.Button?>
      <?import javafx.scene.control.Label?>
      <GridPane fx:controller="sample.Controller"
                xmlns:fx="http://javafx.com/fxml" alignment="center" hgap="10" vgap="10">
      </GridPane>

      == sample/style.css ==
      .popup {
          -fx-font-size: 24px;
      }

      .popup .rect {
          -fx-fill: green;
      }

      .popup .text {
          -fx-text-fill: white;
          -fx-font-weight: bold;
      }
      ---------- END SOURCE ----------

        1. prism-verbose.log
          2 kB
        2. xdpyinfo.log
          68 kB
        3. diff_-r_9137.txt
          2 kB

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: