title: OpenCV Multithreading error [using Qt]
body: <p><strong>Till now I have learnt one thing, there's something wrong I'm doing with OpenCV, Qt has no role in the error</strong></p>
  
  <p>I'm trying to run two methods in different threads, but it gives me error:</p>
  
  <blockquote>
    <p>[xcb] Unknown request in queue while dequeuing<br>
    [xcb] Most likely this is a multi-threaded client and XInitThreads has not been called<br>
    [xcb] Aborting, sorry about that.<br>
    Blurring_Images: ../../src/xcb_io.c:178: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.<br>
    The program has unexpectedly finished.</p>
  </blockquote>
  
  <hr>
  
  <p>Here's my code:</p>
  
  <pre><code>void Dialog::blurImages(int b)
  {
      QtConcurrent::run(this,&amp;Dialog::homogenour_blur,b);
      QtConcurrent::run(this,&amp;Dialog::gaussianBlur,b);
  }
  
  void Dialog::homogenour_blur(int b)
  {
      cv::blur(img,img1,cv::Size(b,b));
      showImage("Homogenous Blur",img1);
  }
  
  void Dialog::gaussianBlur(int b)
  {
      cv::GaussianBlur(img,img2,cv::Size(b,b),b);
      showImage("Gaussian Blur",img2);
  }
  </code></pre>
  
  <p>whereas if i comment out one call(shown below), it runs fine</p>
  
  <pre><code>void Dialog::blurImages(int b)
  {
      QtConcurrent::run(this,&amp;Dialog::homogenour_blur,b);
      //QtConcurrent::run(this,&amp;Dialog::gaussianBlur,b);
  }
  </code></pre>
  
  <p>It's really annoying guys, please help !!</p>
  
  <p><strong>EDIT:</strong>
  Instead of calling showImage(), I replaced it with the actial OpenCV call(see below):</p>
  
  <pre><code>void Dialog::homogenour_blur(int b)
  {
      cv::blur(img,img1,cv::Size(b,b));
      //showImage("Homogenous Blur",img1);
      cv::imshow("Homogenous Blur",img1);
  }
  
  void Dialog::gaussianBlur(int b)
  {
      cv::GaussianBlur(img,img2,cv::Size(b,b),b);
      //showImage("Gaussian Blur",img2);
      cv::imshow("Gaussian Blur",img2);
  }
  </code></pre>
  
  <p>Now the error I get is:</p>
  
  <blockquote>
    <p>Original Image: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.<br>
    Original Image: Fatal IO error 0 (Success) on X server :0.<br>
    Fatal Error: Accessed global static 'KGlobalSettings *s_self()' after destruction. Defined at ../../kdeui/kernel/kglobalsettings.cpp:190<br>
    The program has unexpectedly finished.</p>
  </blockquote>