ovikassingho / gstreamer-java

Automatically exported from code.google.com/p/gstreamer-java
0 stars 0 forks source link

VideoComponent resourceTimer is never stopped #143

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
- What steps will reproduce the problem?
Start a gstreamer application using a org.gstreamer.swing.VideoComponent to 
display a video
Close all windows after the video has displayed for one second
Ensure that all swing components are properly disposed, but do not use 
System.exit(0)

-What is the expected output? What do you see instead?
All threads should stop and the jvm should terminite, however the 
AWT-EventQueue keeps on running.

-Please provide any additional information below.

VideoComponent initiates a resourceTimer (which is a javax.swing.Timer)
This timer is never stopped because of a bug, the part of the code which should 
stop the timer is shown below

    private ActionListener resourceReaper = new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (!frameRendered) {
                if (volatileImage != null) {
                    volatileImage.flush();
                    volatileImage = null;
                }
                // Stop the timer so we don't wakeup needlessly
                resourceTimer.stop();
            }
            frameRendered = false;
        }
    };

What is wrong here is that framerendered can never become false once it is true.
This is because frameRendered is set to false INSIDE the if(!frameRendered) 
block
As a side effect the resourceTimer is never stopped so it will keep on fireing 
events to the EventQueue, which in turn keeps the thread running and prevents 
the JVM from shutting down properly

Original issue reported on code.google.com by Ruudje...@gmail.com on 7 Aug 2014 at 11:47

GoogleCodeExporter commented 8 years ago
please post a patch which fix it

Original comment by lfar...@lfarkas.org on 13 Aug 2014 at 10:25

GoogleCodeExporter commented 8 years ago
Patch added

Original comment by Ruudje...@gmail.com on 14 Aug 2014 at 6:56

Attachments:

GoogleCodeExporter commented 8 years ago
r626 

Original comment by lfar...@lfarkas.org on 14 Aug 2014 at 7:37