"Buffers have not been created" error for sketches w/o draw() #2469

Closed
mariuswatz opened this Issue Apr 20, 2014 · 6 comments

Comments

Projects
None yet
3 participants
@mariuswatz

On Windows: Sketches w/o draw() that call exit() in setup() gives a "Buffers have not been created" error (full stack trace below.) This is a trivial issue for the most part, but can be confusing for sketches that process data in setup() and then exit. Confirmed for 2.1.2 on Windows.

Possible workaround: Creating a draw() w/ a call to exit(), preferably w/ "if(frameCount>5) exit()").

Example:

void setup() {
  exit();
}

produces the below:

Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Buffers have not been created
    at sun.awt.windows.WComponentPeer.getBackBuffer(Unknown Source)
    at java.awt.Component$FlipBufferStrategy.getBackBuffer(Unknown Source)
    at java.awt.Component$FlipBufferStrategy.updateInternalBuffers(Unknown Source)
    at java.awt.Component$FlipBufferStrategy.createBuffers(Unknown Source)
    at java.awt.Component$FlipBufferStrategy.<init>(Unknown Source)
    at java.awt.Component$FlipSubRegionBufferStrategy.<init>(Unknown Source)
    at java.awt.Component.createBufferStrategy(Unknown Source)
    at java.awt.Window.createBufferStrategy(Unknown Source)
    at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source)
    at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source)
    at javax.swing.BufferStrategyPaintManager$BufferInfo.getBufferStrategy(Unknown Source)
    at javax.swing.BufferStrategyPaintManager.prepare(Unknown Source)
    at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
    at javax.swing.RepaintManager.paint(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
    at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
    at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
    at java.awt.Container.paint(Unknown Source)
    at java.awt.Window.paint(Unknown Source)
    at javax.swing.RepaintManager$3.run(Unknown Source)
    at javax.swing.RepaintManager$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.access$1100(Unknown Source)
    at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

Working alternative:

void setup() {
}

void draw() {
   if(frameCount>5) exit();
}

Apologies, as always.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry May 4, 2014

Member

This works for me w/o an error:

void setup() {
  exit();
}

as does this one:

void setup() {
  size(400, 400, P3D);
  exit();
}

Do those give you the error?

Apologies?

Member

benfry commented May 4, 2014

This works for me w/o an error:

void setup() {
  exit();
}

as does this one:

void setup() {
  size(400, 400, P3D);
  exit();
}

Do those give you the error?

Apologies?

@mariuswatz

This comment has been minimized.

Show comment
Hide comment
@mariuswatz

mariuswatz May 6, 2014

Using size(400, 400, P3D); gives no error. The following do give the error listed above, however (Windows, 2.1.2):

void setup() {
  size(400, 400);
  exit();
}

And:

void setup() {
  exit();
}

Trivial, but I've seen it confuse students. Text in red == scary.

Using size(400, 400, P3D); gives no error. The following do give the error listed above, however (Windows, 2.1.2):

void setup() {
  size(400, 400);
  exit();
}

And:

void setup() {
  exit();
}

Trivial, but I've seen it confuse students. Text in red == scary.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry May 8, 2014

Member

No question it's a bug (red text is always bad)... I'm just having trouble replicating it. Will have to try other machines.

Member

benfry commented May 8, 2014

No question it's a bug (red text is always bad)... I'm just having trouble replicating it. Will have to try other machines.

@benfry benfry added the windows label May 10, 2014

@benfry benfry changed the title from "Buffers have not been created" error for sketches w/o draw() [Win] to "Buffers have not been created" error for sketches w/o draw() May 10, 2014

@GKFX

This comment has been minimized.

Show comment
Hide comment
@GKFX

GKFX May 24, 2014

Contributor

All the samples work without errors for me (WinXP SP3, x86, Processing 0228) except the P3D, because I haven't got a graphics card and I get the Framebuffer error (framebuffer unsupported) error.

Contributor

GKFX commented May 24, 2014

All the samples work without errors for me (WinXP SP3, x86, Processing 0228) except the P3D, because I haven't got a graphics card and I get the Framebuffer error (framebuffer unsupported) error.

@benfry benfry added the help wanted label Nov 19, 2014

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Nov 19, 2014

Member

(Adding help tag since I can't reproduce, but hoping that someone else seeing the problem might be able to...)

Member

benfry commented Nov 19, 2014

(Adding help tag since I can't reproduce, but hoping that someone else seeing the problem might be able to...)

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry May 17, 2015

Member

Should be resolved for 3.0a8. A version of this showed up on Linux while testing something else, and it was part of a batch of code that's now been rewritten to avoid threading quirks like this.

Member

benfry commented May 17, 2015

Should be resolved for 3.0a8. A version of this showed up on Linux while testing something else, and it was part of a batch of code that's now been rewritten to avoid threading quirks like this.

@benfry benfry closed this May 17, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment