From 24572f02c16f0931aa195772f9d398a3131f2c9b Mon Sep 17 00:00:00 2001 From: Drew Fisher Date: Thu, 7 Oct 2010 20:54:14 -0700 Subject: [PATCH] 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. --- shareboard.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } -- 2.39.2