[mythtv] Ticket #8139: fix for crash when doing "next link"

Alec Leamas leamas.alec at gmail.com
Tue Mar 16 07:46:05 UTC 2010


Hi!

I just saw that you have fixed "my"  ticket #8139 together with  the old 
keyboard focus problem in changeset 23731 
<http://svn.mythtv.org/trac/changeset/23731> Nice!

I am definitely a newbie, and on top of that it was some years since I 
practised C++. So maybe I should just be quiet, but I'm a litte worried 
by some some code here - it doesn't  seem to be robust:

void MythWebView::keyPressEvent(QKeyEvent *event)
{
...

     if (action == "NEXTLINK")
    {
         QKeyEvent tabKey(event->type(), ...)
         *event = tabKey;
         WebView::keyPressEvent(event)
         return;
     }

...
}

I feel uneasy about the assignment *event = tabKey. Isn't this a 
potential risk for memory leaks or worse if event is a plain, non-smart 
pointer to a dynamically allocated object? Put in another way, is it 
really part of the overall contract for keyPressEvent that a subclass  
implementation can make this kind of assignment?

Sorry if I take your time with nonsense, just ignore this in that case.

Cheers!

--alec
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mythtv.org/pipermail/mythtv-dev/attachments/20100316/43ead0c4/attachment.htm>


More information about the mythtv-dev mailing list