mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 691909 - Avoid an unnecessary memory allocation for GTK clipboard code; r=roc
--HG-- extra : rebase_source : 2d4ae14de525809bded55e235867b058993f6c94
This commit is contained in:
parent
72d69a661c
commit
3ab76b7ec2
@ -953,7 +953,6 @@ clipboard_contents_received(GtkClipboard *clipboard,
|
||||
{
|
||||
retrieval_context *context = static_cast<retrieval_context *>(data);
|
||||
if (context->timed_out) {
|
||||
delete context;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -967,20 +966,16 @@ clipboard_contents_received(GtkClipboard *clipboard,
|
||||
static GtkSelectionData *
|
||||
wait_for_contents(GtkClipboard *clipboard, GdkAtom target)
|
||||
{
|
||||
retrieval_context *context = new retrieval_context();
|
||||
retrieval_context context;
|
||||
gtk_clipboard_request_contents(clipboard, target,
|
||||
clipboard_contents_received,
|
||||
context);
|
||||
&context);
|
||||
|
||||
if (!wait_for_retrieval(clipboard, context)) {
|
||||
// Don't delete |context|; the callback will when it eventually
|
||||
// comes back.
|
||||
if (!wait_for_retrieval(clipboard, &context)) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
GtkSelectionData *result = static_cast<GtkSelectionData *>(context->data);
|
||||
delete context;
|
||||
return result;
|
||||
return static_cast<GtkSelectionData *>(context.data);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -990,7 +985,6 @@ clipboard_text_received(GtkClipboard *clipboard,
|
||||
{
|
||||
retrieval_context *context = static_cast<retrieval_context *>(data);
|
||||
if (context->timed_out) {
|
||||
delete context;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1001,16 +995,12 @@ clipboard_text_received(GtkClipboard *clipboard,
|
||||
static gchar *
|
||||
wait_for_text(GtkClipboard *clipboard)
|
||||
{
|
||||
retrieval_context *context = new retrieval_context();
|
||||
gtk_clipboard_request_text(clipboard, clipboard_text_received, context);
|
||||
retrieval_context context;
|
||||
gtk_clipboard_request_text(clipboard, clipboard_text_received, &context);
|
||||
|
||||
if (!wait_for_retrieval(clipboard, context)) {
|
||||
// Don't delete |context|; the callback will when it eventually
|
||||
// comes back.
|
||||
if (!wait_for_retrieval(clipboard, &context)) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
gchar *result = static_cast<gchar *>(context->data);
|
||||
delete context;
|
||||
return result;
|
||||
return static_cast<gchar *>(context.data);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user