[mythtv] Guidegrid.cpp patch maybe???

Brent Hills bhills at openshores.com
Fri Jan 31 12:02:14 EST 2003


I've mentioned to the list once before I was having problems with
mythfrontend dying when exiting the program guide and returning to live
tv mode about 1 out of every 3 times I went in the guide.

Running under gdb the program didn't die but I would see XError
Badwindow() messages that conformed with the same timeframe I expected
to see the program crash.

I have attached a patch which stops the problem from occurring for me. 
I don't really know enough about multithreading QT applications to know
if my fix is correct or just avoiding some kind of race condition.

The idea of the patch was to wrap the deconstruction of the gg instance
of GuideGrid inside qApp-lock()/unlock()

After applying the patch below I can't repeat the problem but I don't
know if the fix is valid.

Can someone with a deeper understanding inform me if the code makes any
kind of sense or helps to point to the problem.

Thanks,
Brent

-------------- next part --------------
--- mythtv/MC/libs/libmythtv/guidegrid.cpp	2003-01-22 19:02:53.000000000 -0800
+++ mythtvrevised/MC/libs/libmythtv/guidegrid.cpp	2003-01-31 11:13:52.000000000 -0800
@@ -29,9 +29,10 @@
 QString RunProgramGuide(MythContext *context, QString startchannel, bool thread,
                         TV *player)
 {
+    QString chanstr ;
+	{
     if (thread)
         qApp->lock();
-
     GuideGrid gg(context, startchannel, player);
 
     if (thread)
@@ -45,10 +46,14 @@
     else
         gg.exec();
 
-    QString chanstr = gg.getLastChannel();
+    chanstr = gg.getLastChannel();
+    if (thread)
+        qApp->lock();
+	}
+    if (thread)
+        qApp->unlock();
     if (chanstr == QString::null)
         chanstr = "";
-
     return chanstr;
 }
 


More information about the mythtv-dev mailing list