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;