added null point handling for get dragging file directory.
This commit is contained in:
parent
952be51c8c
commit
10b9b2e406
|
@ -363,7 +363,6 @@ CMSWindowsScreen::leave()
|
|||
|
||||
if (getDraggingStarted()) {
|
||||
CString& draggingDir = getDraggingFileDir();
|
||||
LOG((CLOG_DEBUG "get dragging file dir: %s", draggingDir.c_str()));
|
||||
size_t size = draggingDir.size();
|
||||
|
||||
if (!m_isPrimary) {
|
||||
|
@ -373,13 +372,15 @@ CMSWindowsScreen::leave()
|
|||
|
||||
fakeMouseButton(kButtonLeft, false);
|
||||
|
||||
CClientApp& app = CClientApp::instance();
|
||||
CClient* client = app.getClientPtr();
|
||||
UInt32 fileCount = 1;
|
||||
LOG((CLOG_DEBUG "send dragging info to server: %s", draggingDir.c_str()));
|
||||
client->draggingInfoSending(fileCount, draggingDir, size);
|
||||
LOG((CLOG_DEBUG "send dragging file to server"));
|
||||
client->sendFileToServer(draggingDir.c_str());
|
||||
if (draggingDir.empty() == false) {
|
||||
CClientApp& app = CClientApp::instance();
|
||||
CClient* client = app.getClientPtr();
|
||||
UInt32 fileCount = 1;
|
||||
LOG((CLOG_DEBUG "send dragging info to server: %s", draggingDir.c_str()));
|
||||
client->draggingInfoSending(fileCount, draggingDir, size);
|
||||
LOG((CLOG_DEBUG "send dragging file to server"));
|
||||
client->sendFileToServer(draggingDir.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
m_draggingStarted = false;
|
||||
|
|
|
@ -900,11 +900,7 @@ COSXScreen::leave()
|
|||
hideCursor();
|
||||
|
||||
if (getDraggingStarted()) {
|
||||
CFStringRef dragInfo = getDraggedFileURL();
|
||||
char* dragInfoCStr = CFStringRefToUTF8String(dragInfo);
|
||||
LOG((CLOG_DEBUG "drag info: %s", dragInfoCStr));
|
||||
CFRelease(dragInfo);
|
||||
CString fileList(dragInfoCStr);
|
||||
CString& fileList = getDraggingFileDir();
|
||||
size_t size = fileList.size();
|
||||
|
||||
if (!m_isPrimary) {
|
||||
|
@ -916,12 +912,15 @@ COSXScreen::leave()
|
|||
|
||||
// fake ctrl key up
|
||||
fakeKeyUp(29);
|
||||
CClientApp& app = CClientApp::instance();
|
||||
CClient* client = app.getClientPtr();
|
||||
UInt32 fileCount = 1;
|
||||
client->draggingInfoSending(fileCount, fileList, size);
|
||||
LOG((CLOG_DEBUG "send dragging file to server"));
|
||||
client->sendFileToServer(dragInfoCStr);
|
||||
|
||||
if (fileList.empty() == false) {
|
||||
CClientApp& app = CClientApp::instance();
|
||||
CClient* client = app.getClientPtr();
|
||||
UInt32 fileCount = 1;
|
||||
client->draggingInfoSending(fileCount, fileList, size);
|
||||
LOG((CLOG_DEBUG "send dragging file to server"));
|
||||
client->sendFileToServer(fileList.c_str());
|
||||
}
|
||||
}
|
||||
m_draggingStarted = false;
|
||||
}
|
||||
|
@ -2100,11 +2099,17 @@ COSXScreen::getDraggingFileDir()
|
|||
{
|
||||
if (m_draggingStarted) {
|
||||
CFStringRef dragInfo = getDraggedFileURL();
|
||||
char* info = CFStringRefToUTF8String(dragInfo);
|
||||
LOG((CLOG_DEBUG "drag info: %s", info));
|
||||
CFRelease(dragInfo);
|
||||
CString fileList(info);
|
||||
m_draggingFileDir = fileList;
|
||||
char* info = NULL;
|
||||
info = CFStringRefToUTF8String(dragInfo);
|
||||
if (info == NULL) {
|
||||
m_draggingFileDir.clear();
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "drag info: %s", info));
|
||||
CFRelease(dragInfo);
|
||||
CString fileList(info);
|
||||
m_draggingFileDir = fileList;
|
||||
}
|
||||
}
|
||||
return m_draggingFileDir;
|
||||
}
|
||||
|
|
|
@ -1750,10 +1750,13 @@ CServer::onMouseMovePrimary(SInt32 x, SInt32 y)
|
|||
if (m_screen->getDraggingStarted() && m_active != newScreen) {
|
||||
CString& dragFileList = m_screen->getDraggingFileDir();
|
||||
size_t size = dragFileList.size() + 1;
|
||||
char* fileList = new char[size];
|
||||
memcpy(fileList, dragFileList.c_str(), size);
|
||||
fileList[size - 1] = '\0';
|
||||
char* fileList = NULL;
|
||||
UInt32 fileCount = 1;
|
||||
if (dragFileList.empty() == false) {
|
||||
fileList = new char[size];
|
||||
memcpy(fileList, dragFileList.c_str(), size);
|
||||
fileList[size - 1] = '\0';
|
||||
}
|
||||
|
||||
// fake a escape key down and up then left mouse button up
|
||||
m_screen->keyDown(kKeyEscape, 8192, 1);
|
||||
|
@ -1769,11 +1772,12 @@ CServer::onMouseMovePrimary(SInt32 x, SInt32 y)
|
|||
m_ignoreFileTransfer = true;
|
||||
#endif
|
||||
|
||||
LOG((CLOG_DEBUG2 "sending drag information to client"));
|
||||
LOG((CLOG_DEBUG3 "dragging file list: %s", fileList));
|
||||
LOG((CLOG_DEBUG3 "dragging file list string size: %i", size));
|
||||
newScreen->draggingInfoSending(fileCount, fileList, size);
|
||||
//m_screen->setDraggingStarted(false);
|
||||
if (dragFileList.empty() == false) {
|
||||
LOG((CLOG_DEBUG2 "sending drag information to client"));
|
||||
LOG((CLOG_DEBUG3 "dragging file list: %s", fileList));
|
||||
LOG((CLOG_DEBUG3 "dragging file list string size: %i", size));
|
||||
newScreen->draggingInfoSending(fileCount, fileList, size);
|
||||
}
|
||||
}
|
||||
|
||||
// switch screen
|
||||
|
|
Loading…
Reference in New Issue