From 89b2fbbae09f64d75ad938a2023b293f1f5b9e6b Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Thu, 19 Jun 2014 10:27:23 +0200 Subject: [PATCH] Bugfix: prevent the "bad drawable" error when showing the OpenGL canvas. #2015 #2099 --- lib/Slic3r/GUI/PreviewCanvas.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Slic3r/GUI/PreviewCanvas.pm b/lib/Slic3r/GUI/PreviewCanvas.pm index 22cb80d4b..97ca63a57 100644 --- a/lib/Slic3r/GUI/PreviewCanvas.pm +++ b/lib/Slic3r/GUI/PreviewCanvas.pm @@ -383,8 +383,10 @@ sub InitGL { sub Render { my ($self, $dc) = @_; - - return unless $self->GetContext; + + # prevent calling SetCurrent() when window is not shown yet + return unless $self->IsShownOnScreen; + return unless my $context = $self->GetContext; $self->SetCurrent($self->GetContext); $self->InitGL;