From cf1b25dfc84d18397d984ffd22e161ab44908b6a 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 d6d61de2f0..522a0507cd 100644 --- a/lib/Slic3r/GUI/PreviewCanvas.pm +++ b/lib/Slic3r/GUI/PreviewCanvas.pm @@ -382,8 +382,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;