From: Drew Fisher Date: Fri, 8 Oct 2010 03:54:14 +0000 (-0700) Subject: Fix double-insertion of action pointer into localActions array. X-Git-Url: https://git.zarvox.org/?a=commitdiff_plain;h=24572f02c16f0931aa195772f9d398a3131f2c9b;p=shareboard.git Fix double-insertion of action pointer into localActions array. The bug here caused segfaults on the arrival of the second server-approved event from the client, since the Action had already been deleted. --- diff --git a/shareboard.cpp b/shareboard.cpp index cd39d63..171c490 100644 --- a/shareboard.cpp +++ b/shareboard.cpp @@ -16,6 +16,9 @@ Shareboard::Shareboard(QWidget* parent) : QWidget(parent) { setLayout(layout); setMinimumSize(640,480); + // All real userIDs are positive, so we won't trigger the delete in postAction until setUserID is called + userID = -1; + QObject::connect(prompt, SIGNAL(connectToServer(QString, QString)), this, SIGNAL(connectToServer(QString, QString))); QObject::connect(canvas, SIGNAL(mouseMovedTo(QPointF)), this, SLOT(handleMouseMoved(QPointF))); QObject::connect(canvas, SIGNAL(segmentDrawn(QPointF,QPointF)), this, SLOT(handleSegmentDrawn(QPointF,QPointF))); @@ -32,7 +35,6 @@ void Shareboard::handleMouseMoved(QPointF pos) { MouseMoveAction* action = new MouseMoveAction(); action->userID = userID; action->pos = pos; - localHistory.append(action); emit actionHappened(action); qDebug() << "shareboard.cpp: mouse moved to" << pos; }