roadlabs / cefpython

Automatically exported from code.google.com/p/cefpython
0 stars 0 forks source link

PyQt example crashes when closing window #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.python pyqt4.py
2.Click the close button
3.

What is the expected output? What do you see instead?
Expected is no output, instead I get this on the console.
[1127/084154]:ERROR_REPORT:browser_impl.h(181)] Check failed: 
CefThread::CurrentlyOn(CefThread::UI).

What version of the product are you using? On what operating system?
cefpython 0.45

Please provide any additional information below.
Curiously, this issue appears on my system but on another system it works 
without a problem.

Original issue reported on code.google.com by codeprop...@gmail.com on 27 Nov 2012 at 2:47

GoogleCodeExporter commented 9 years ago
There is a topic on CEF forum regarding this matter:
http://magpcss.org/ceforum/viewtopic.php?f=6&t=10252

I'm not sure how threads in Qt work.

Original comment by czarek.t...@gmail.com on 27 Nov 2012 at 2:56

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by czarek.t...@gmail.com on 27 Nov 2012 at 3:06

GoogleCodeExporter commented 9 years ago
Fixed in revision 2469d5441fd3.

The solution was to assign None to QApplication before calling shutdown:

  app = None
  cefpython.Shutdown()

This fix removed errors in the console, I'm assuming it also fixed the crash, 
but as I couldn't reproduce it, I'm not 100% sure, so better test it.

Original comment by czarek.t...@gmail.com on 27 Nov 2012 at 9:46

GoogleCodeExporter commented 9 years ago
Verified. Issue disappears if None is assigned to app. App must be garbage 
collected by null assignment but not sure how/why it was causing the error in 
first place.

Original comment by codeprop...@gmail.com on 27 Nov 2012 at 11:34

GoogleCodeExporter commented 9 years ago
I guess Qt could still run some internal threads that collided with shutdown or 
something. It makes sense, we called cefpython.Initialize() before QApplication 
was initialized, so we should destroy QApplication (it also needs to do some 
cleanup, probably called in destructor) before cefpython.shutdown().

Original comment by czarek.t...@gmail.com on 28 Nov 2012 at 12:39