title: Creating one event from another - do I have memory leak?
body: <p>Who is responsible for managing events ?</p>
  
  <p>For the following code:</p>
  
  <pre><code>bool MyView::gestureEvent(QGestureEvent *event)
  {
      if (QGesture *hold = event-&gt;gesture(Qt::TapAndHoldGesture))
          holdTriggered(static_cast&lt;QTapAndHoldGesture *&gt;(hold));
      return true;
  }
  
  void MyView::holdTriggered(QTapAndHoldGesture *event)
  {
      QPoint currentTouchPointPos = event-&gt;position().toPoint();
      QContextMenuEvent *event1 = new QContextMenuEvent(
                  QContextMenuEvent::Mouse, currentTouchPointPos,
                  currentTouchPointPos, Qt::NoModifier);
      QGraphicsView::contextMenuEvent(event1);
  }
  </code></pre>
  
  <p>I ran it under Valgrind and it told me I have a memory leak.</p>
  
  <p>Which is the leak, <code>event</code> or <code>event1</code> ?</p>
  
  <p>Should I delete one of them, or both ? Or do I need to accept or ignore them ?</p>
  
  <p>(I tried deleting <code>event1</code> because it is the one I created, and Valgrind still said I had a memory leak; but <code>event</code> is really passed from the caller so I should not touch it, I think - and even about <code>event1</code> I am not sure - will not sending it to <code>QGraphicsView</code> take care of it ?)</p>