Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
ccce123c
Commit
ccce123c
authored
4 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Fix leak on pasting from clipboard on macos
parent
5e814696
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
indra/llwindow/llwindowmacosx-objc.h
+1
-1
1 addition, 1 deletion
indra/llwindow/llwindowmacosx-objc.h
indra/llwindow/llwindowmacosx-objc.mm
+18
-16
18 additions, 16 deletions
indra/llwindow/llwindowmacosx-objc.mm
indra/llwindow/llwindowmacosx.cpp
+4
-2
4 additions, 2 deletions
indra/llwindow/llwindowmacosx.cpp
with
23 additions
and
19 deletions
indra/llwindow/llwindowmacosx-objc.h
+
1
−
1
View file @
ccce123c
...
...
@@ -83,7 +83,7 @@ int createNSApp(int argc, const char **argv);
void
setupCocoa
();
bool
pasteBoardAvailable
();
bool
copyToPBoard
(
const
unsigned
short
*
str
,
unsigned
int
len
);
const
unsigned
short
*
copyFromPBoard
();
unsigned
short
*
copyFromPBoard
();
CursorRef
createImageCursor
(
const
char
*
fullpath
,
int
hotspotX
,
int
hotspotY
);
short
releaseImageCursor
(
CursorRef
ref
);
short
setImageCursor
(
CursorRef
ref
);
...
...
This diff is collapsed.
Click to expand it.
indra/llwindow/llwindowmacosx-objc.mm
+
18
−
16
View file @
ccce123c
...
...
@@ -79,22 +79,24 @@ bool pasteBoardAvailable()
return
[[
NSPasteboard
generalPasteboard
]
canReadObjectForClasses
:
classArray
options
:[
NSDictionary
dictionary
]];
}
const
unsigned
short
*
copyFromPBoard
()
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
NSPasteboard
*
pboard
=
[
NSPasteboard
generalPasteboard
];
NSArray
*
classArray
=
[
NSArray
arrayWithObject
:[
NSString
class
]];
NSString
*
str
=
NULL
;
BOOL
ok
=
[
pboard
canReadObjectForClasses
:
classArray
options
:[
NSDictionary
dictionary
]];
if
(
ok
)
{
NSArray
*
objToPaste
=
[
pboard
readObjectsForClasses
:
classArray
options
:[
NSDictionary
dictionary
]];
str
=
[
objToPaste
objectAtIndex
:
0
];
}
unichar
*
temp
=
(
unichar
*
)
calloc
([
str
length
]
+
1
,
sizeof
(
unichar
));
[
str
getCharacters
:
temp
];
[
pool
release
];
return
temp
;
unsigned
short
*
copyFromPBoard
()
{
@autoreleasepool
{
NSPasteboard
*
pboard
=
[
NSPasteboard
generalPasteboard
];
NSArray
*
classArray
=
[
NSArray
arrayWithObject
:[
NSString
class
]];
NSString
*
str
=
NULL
;
BOOL
ok
=
[
pboard
canReadObjectForClasses
:
classArray
options
:[
NSDictionary
dictionary
]];
if
(
ok
)
{
NSArray
*
objToPaste
=
[
pboard
readObjectsForClasses
:
classArray
options
:[
NSDictionary
dictionary
]];
str
=
[
objToPaste
objectAtIndex
:
0
];
}
NSUInteger
len
=
[
str
length
];
unichar
*
temp
=
(
unichar
*
)
calloc
(
len
+
1
,
sizeof
(
unichar
));
[
str
getCharacters
:
temp
range
:
NSMakeRange
(
0
,
len
)];
return
temp
;
}
}
CursorRef
createImageCursor
(
const
char
*
fullpath
,
int
hotspotX
,
int
hotspotY
)
...
...
This diff is collapsed.
Click to expand it.
indra/llwindow/llwindowmacosx.cpp
+
4
−
2
View file @
ccce123c
...
...
@@ -1237,8 +1237,10 @@ BOOL LLWindowMacOSX::isClipboardTextAvailable()
}
BOOL
LLWindowMacOSX
::
pasteTextFromClipboard
(
LLWString
&
dst
)
{
llutf16string
str
(
copyFromPBoard
());
{
unsigned
short
*
temp
=
copyFromPBoard
();
llutf16string
str
(
temp
);
free
(
temp
);
dst
=
utf16str_to_wstring
(
str
);
if
(
dst
!=
L""
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment