title: cv::imshow blocks thread when GUI application runs
body: <p>I've been trying to debug this for a while but I'm at wit's end so I'll try to ask this here. I guess I'm just asking for hints on what could cause this.</p>
  
  <p>I have two programs: A C++ back-end that does a lot of computer vision stuff, and a Python front-end that shows a GUI. The GUI is the entry point and starts up the back-end after loading. Currently, the back-end somehow blocks its main thread here:</p>
  
  <pre><code>if(image.size() != getImageSize()) {
      cv::imshow("projectorDisplay",display_image(cv::Rect(0,0,getImageSize().width,getImageSize().height)));
  } else {
      cv::imshow("projectorDisplay",display_image); //Thread blocks at this line.
  }
  cv::waitKey(10);
  </code></pre>
  
  <p>It's meant to display display_image on a projector that's connected to the computer. The image doesn't get displayed, and the thread blocks so the back-end doesn't get any further. The window is created in the constructor of the same class as follows:</p>
  
  <pre><code>cv::namedWindow("projectorDisplay",CV_WINDOW_NORMAL);
  cv::moveWindow("projectorDisplay",2000,0); //Move the window to the projector screen. TODO: Hard-coded value.
  cv::setWindowProperty("projectorDisplay",CV_WND_PROP_FULLSCREEN,CV_WINDOW_FULLSCREEN); //Make fullscreen.
  cv::waitKey(50);
  </code></pre>
  
  <p>But here's the strange part that led me to think this is a very difficult bug: <strong>When I run the back-end without the GUI, it works fine.</strong> The GUI is a fairly simple Qt-based application in Python that communicates commands via local sockets to the back-end. It should be completely separate; it's even written in a script-language, and runs also when the back-end is not present (the back-end is a plug-in).</p>
  
  <p>Some other things I noticed while debugging:</p>
  
  <ul>
  <li>This bug is only on Windows. At least, it doesn't occur in Ubuntu.</li>
  <li>When I add <code>cv::imshow("projectorDisplay",cv::imread("testimage.png"));</code> to the constructor, it is displayed properly.</li>
  <li>When I add <code>cv::imshow("projectorDisplay",cv::imread("testimage.png"));</code> instead of the line where it otherwise gets blocked, it blocks at the new <code>imshow</code> too, so it's not just an issue of a corrupt image.</li>
  <li>The issue remains if I don't make the window full-screen in the constructor.</li>
  <li>When I replace the blocking line with <code>cv::imshow("projectorDisplay2",display_image)</code>, a new window is created and the image is displayed correctly.</li>
  <li>When I change the <code>CV_WINDOW_NORMAL</code> flag to <code>CV_WINDOW_OPENGL</code> in the constructor, the back-end crashes immediately at launch.</li>
  </ul>
  
  <p>Does anyone have an idea of what could cause such a thing and where I should look to fix it?</p>