SYNERGY1-1497 Fix memory leak on macOS (#7178)

* SYNERGY1-1497 Fix memory leak on macOS

* Update ChangeLog

* Fix Fedora build
This commit is contained in:
Serhii Hadzhilov 2022-05-24 14:36:06 +03:00 committed by GitHub
parent 95ee948f26
commit c92ac1a71e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 9 deletions

View file

@ -25,6 +25,12 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Work around https://github.com/actions/checkout/issues/766
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Build
run: |

View file

@ -10,7 +10,7 @@ Bug fixes:
- #7149 Address issues with modifiers and dead keys
- #7163 Fix compilation issues for FreeBSD
- #7172 Memory leaks in language sync and TLS functionality
- #7175 Memory leaks in copy/paste and drag and drop functionality
- #7175 | #7178 Memory leaks in copy/paste and drag and drop functionality
Github Actions:
- #7148 Fix unstable build for windows core

View file

@ -814,7 +814,7 @@ Client::handleResume(const Event&, void*)
void
Client::handleFileChunkSending(const Event& event, void*)
{
sendFileChunk(event.getData());
sendFileChunk(event.getDataObject());
}
void

View file

@ -86,8 +86,11 @@ fakeDragging(const char* str, int cursorX, int cursorY)
[g_dragView setFileExt:g_ext];
CGEventRef down = CGEventCreateMouseEvent(CGEventSourceCreate(kCGEventSourceStateHIDSystemState), kCGEventLeftMouseDown, CGPointMake(cursorX, cursorY), kCGMouseButtonLeft);
CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
CGEventRef down = CGEventCreateMouseEvent(source, kCGEventLeftMouseDown, CGPointMake(cursorX, cursorY), kCGMouseButtonLeft);
CGEventPost(kCGHIDEventTap, down);
CFRelease(down);
CFRelease(source);
});
}

View file

@ -32,6 +32,7 @@
#include <mach/mach_interface.h>
#include <mach/mach_init.h>
#include <IOKit/IOMessage.h>
#include <memory>
extern "C" {
typedef int CGSConnectionID;
@ -336,7 +337,7 @@ private:
IEventQueue* m_events;
Thread* m_getDropTargetThread;
std::unique_ptr<Thread> m_getDropTargetThread;
String m_dropTarget;
#if defined(MAC_OS_X_VERSION_10_7)

View file

@ -117,7 +117,7 @@ OSXScreen::OSXScreen(IEventQueue* events,
m_lastSingleClickXCursor(0),
m_lastSingleClickYCursor(0),
m_events(events),
m_getDropTargetThread(NULL),
m_getDropTargetThread(nullptr),
m_impl(NULL)
{
m_displayID = CGMainDisplayID();
@ -602,8 +602,8 @@ OSXScreen::fakeMouseButton(ButtonID id, bool press)
if (!press && (id == kButtonLeft)) {
if (m_fakeDraggingStarted) {
m_getDropTargetThread = new Thread(new TMethodJob<OSXScreen>(
this, &OSXScreen::getDropTargetThread));
auto method = new TMethodJob<OSXScreen>(this, &OSXScreen::getDropTargetThread);
m_getDropTargetThread.reset(new Thread(method));
}
m_draggingStarted = false;
@ -1206,8 +1206,8 @@ OSXScreen::onMouseButton(bool pressed, UInt16 macButton)
}
else {
if (m_fakeDraggingStarted) {
m_getDropTargetThread = new Thread(new TMethodJob<OSXScreen>(
this, &OSXScreen::getDropTargetThread));
auto method = new TMethodJob<OSXScreen>(this, &OSXScreen::getDropTargetThread);
m_getDropTargetThread.reset(new Thread(method));
}
m_draggingStarted = false;