[mythtv-commits] mythtv/master commit: 1399a9c13 by Gavin Hurlbut (Beirdo)

MythTV noreply at mythtv.org
Tue Mar 13 06:30:42 UTC 2012

      Author:  Gavin Hurlbut <ghurlbut at mythtv.org>
 Change Date:  2012-03-12T23:30:12-07:00
   Push Date:  2012/03/12 23:30:27 -0700
  Repository:  mythtv
      Branch:  master
New Revision:  1399a9c1368b489c9e874004030a463ff66d6bd3
   Changeset:  https://github.com/MythTV/mythtv/commit/1399a9c13


Make mythuiwebbrowser and mythdownloadmanager share cookies

Fixes #9802

Seems that Qt went out of their way to make QNetworkCookieJars difficult to
work with.  They are not threadsafe (as you can not move them from a QObject
owner in one thread to a QObject owner in another, even if shared).  They also
disabled copying them.  Argh.

So...  Since I already had subclassed it to MythCookieJar anyways, I added the
copy functionality within the subclass.  Unfortunately to use this, you need
to use some unsavory static_casts on the pointers to force it to allow you
to effectively copy from the master class to the subclass... and back...  Yuk!

So, to share the cookie jar as best we can, when a mythuiwebbrowser starts up,
it takes a copy of the cookie jar that the mythdownloadmanager is holding.
When the mythuiwebbrowser is torn down, it copies the cookie jar back into
the mythdownloadmanager, which then will copy from that temporary jar into its
actual cookie jar at a convenient time in its processing.

The cookie jar in the mythdownloadmanager is protected by a mutex so that there
should be no clobbering at the same time.  However, since the MDM could have
updated the jar while the browser was running, there is some possibility that
any cookies the MDM accumulated during that time will be lost on refresh from
the browser.



More information about the mythtv-commits mailing list