<div dir="ltr">Can you load your app in the debugger to see where the crash happens? <div><br></div><div>the 'maximum number of clients' error might be because you don't close the X window when you close a tab.<div>Instead of just setting the view to nullptr try to delete the view as well.</div></div><div><br></div><div>Dan</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 16, 2017 at 4:48 AM, Jan Niklas Hasse <span dir="ltr"><<a href="mailto:jan-niklas.hasse@stw.de" target="_blank">jan-niklas.hasse@stw.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Dan,<br>
<br>
yes, kind of. The problem is, that with a lot of tabs I'm getting:<br>
<br>
Maximum number of clients reached<br>
ERROR: In [...]/VTK/Rendering/OpenGL/<wbr>vtkXOpenGLRenderWindow.cxx, line 530<br>
vtkXOpenGLRenderWindow (0x32b207d0): bad X server connection. DISPLAY=:0. Aborting.<br>
<br>
calling chart->SetVisible(false) doesn't help unfortunately. I need to completely destroy the view somehow in hideEvent.<br>
<br>
Thanks<br>
<span class="HOEnZb"><font color="#888888">Jan<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Fri, 18 Nov 2016, at 14:57, Dan Lipsa wrote:<br>
> Jan,<br>
> To hide items in a scene you have to  call SetVisible(false) on them. Is this what you are trying to do?<br>
><br>
> Dan<br>
><br>
><br>
><br>
> On Fri, Nov 18, 2016 at 5:51 AM, Jan Niklas Hasse <<a href="mailto:jan-niklas.hasse@stw.de">jan-niklas.hasse@stw.de</a>> wrote:<br>
>> Hi,<br>
>><br>
>>  I'm using VTK 6.2 with Qt. I've created a class Plot2D which inherits from QVTKWidget. I now have a lot of these plots widgets in a tabbed view and want to only render the ones that are currently visible (otherwise I get an OpenGL crash).<br>
>><br>
>>  void Plot2D::showEvent(QShowEvent*) {<br>
>>      view = vtkSmartPointer<<wbr>vtkContextView>::New();<br>
>>      view->GetRenderer()-><wbr>SetBackground(1,1,1);<br>
>>      view->SetRenderWindow(<wbr>GetRenderWindow());<br>
>>      view->GetRenderWindow()-><wbr>SetSize(width(),height());<br>
>>      view->GetScene()->AddItem(<wbr>chart);<br>
>>      view->GetRenderWindow()-><wbr>SetMultiSamples(0);<br>
>>      view->GetRenderWindow()-><wbr>Render();<br>
>>  }<br>
>><br>
>>  void Plot2D::hideEvent(QHideEvent*) {<br>
>>      view = nullptr;<br>
>>  }<br>
>><br>
>>  Unfortunately, deleting the vtkContextView isn't enough: The next time showEvent is called, I get a crash inside VTK because it seems that view->GetRenderWindow()-><wbr>Render(); has set up some kind of timer in the background. How would I solve this?<br>
>><br>
>>  Thanks in advance :)<br>
>>  Jan<br>
>>  ______________________________<wbr>_________________<br>
>>  Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
>><br>
>>  Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
>><br>
>>  Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br>
>><br>
>>  Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
>><br>
>>  Follow this link to subscribe/unsubscribe:<br>
>>  <a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div><br></div>