Skip to content

Commit

Permalink
Tweaks to fix setCONNTest on Windows 8
Browse files Browse the repository at this point in the history
 - Temporarily disabled the sending of a CONF message from the plugin in response to setCONN. The CONF message causes crashes on Windows 8 when setCONN is called multiple times.
 -  Removed code that attempted to free result slots in parseRequest before overwritting them with new allocations. The CTests suite currently calls parseRequest with a multidimensional array allocated on the stack, resulting in an attempt to free stack memory. A better solution may be to simply check whether the existing result slots are long enough.
 - As of this commit, all tests in the CTests suite are passing on Windows 8 for X-Plane 9, X-Plane 10 23bit and X-Plane 10 64bit.
  • Loading branch information
jason-watkins committed Mar 24, 2015
1 parent fbeb297 commit 66b074d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions C/src/xplaneConnect.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,10 +571,10 @@ short parseRequest(const char my_message[], float *resultArray[], short arraySiz
for (i=0; i<count; i++)
{
arraySizes[i] = my_message[place];
if (resultArray[i] != NULL)
{
free(resultArray[i]);
}
//if (resultArray[i] != NULL)
//{
// free(resultArray[i]);
//}
resultArray[i] = malloc(arraySizes[i]*sizeof(float));

memcpy(resultArray[i],&my_message[place + 1],arraySizes[i]*sizeof(float));
Expand Down
Binary file modified xpcPlugin/Win/xpcPlugin32.xpl
Binary file not shown.
Binary file modified xpcPlugin/Win/xpcPlugin64.xpl
Binary file not shown.
7 changes: 4 additions & 3 deletions xpcPlugin/XPCPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,10 @@ int handleCONN(char buf[])
updateLog(logmsg,strlen(logmsg));

// SEND CONFIRMATION
memcpy(sendSocket.xpIP,connectionList[current_connection].IP, sizeof(connectionList[current_connection].IP));
sendSocket.xpPort = connectionList[current_connection].recPort;
sendUDP(sendSocket, the_message, 5);
// TODO: Ivestigate why sending confirmation causes crashes on Windows 8
//memcpy(sendSocket.xpIP,connectionList[current_connection].IP, sizeof(connectionList[current_connection].IP));
//sendSocket.xpPort = connectionList[current_connection].recPort;
//sendUDP(sendSocket, the_message, 5);

return 0;
}
Expand Down

0 comments on commit 66b074d

Please sign in to comment.