Skip to content

Commit 02c668a

Browse files
committed
Update: add CFRelease source
1 parent 5c28644 commit 02c668a

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

key/keypress_c.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ void toggleKeyCode(MMKeyCode code, const bool down, MMKeyFlags flags, uintptr pi
189189
}
190190

191191
SendTo(pid, keyEvent);
192+
CFRelease(source);
192193
}
193194
#elif defined(IS_WINDOWS)
194195
const DWORD dwFlags = down ? 0 : KEYEVENTF_KEYUP;
@@ -284,6 +285,7 @@ void toggleKey(char c, const bool down, MMKeyFlags flags, uintptr pid) {
284285
CGEventKeyboardSetUnicodeString(keyEvent, 1, &ch);
285286

286287
SendTo(pid, keyEvent);
288+
CFRelease(source);
287289
}
288290
#else
289291
#define toggleUniKey(c, down) toggleKey(c, down, MOD_NONE, 0)

mouse/mouse_c.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ void moveMouse(MMPointInt32 point){
9191

9292
CGEventPost(kCGHIDEventTap, move);
9393
CFRelease(move);
94+
CFRelease(source);
9495
#elif defined(USE_X11)
9596
Display *display = XGetMainDisplay();
9697
XWarpPointer(display, None, DefaultRootWindow(display), 0, 0, 0, 0, point.x, point.y);
@@ -112,6 +113,7 @@ void dragMouse(MMPointInt32 point, const MMMouseButton button){
112113

113114
CGEventPost(kCGHIDEventTap, drag);
114115
CFRelease(drag);
116+
CFRelease(source);
115117
#else
116118
moveMouse(point);
117119
#endif
@@ -152,6 +154,7 @@ void toggleMouse(bool down, MMMouseButton button) {
152154

153155
CGEventPost(kCGHIDEventTap, event);
154156
CFRelease(event);
157+
CFRelease(source);
155158
#elif defined(USE_X11)
156159
Display *display = XGetMainDisplay();
157160
XTestFakeButtonEvent(display, button, down ? True : False, CurrentTime);

0 commit comments

Comments
 (0)