mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-09 08:48:07 +00:00
fix hang that can result from pasting a null selection
This commit is contained in:
parent
32b54070f7
commit
48b49d453f
@ -285,7 +285,7 @@ nsresult nsSelectionMgr::PasteTextBlocking(nsString *aPastedText)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Now we need to wait until the callback comes in ...
|
// Now we need to wait until the callback comes in ...
|
||||||
// i is in case we get a runaway.
|
// i is in case we get a runaway (yuck).
|
||||||
for (int i=0; mBlocking == PR_TRUE && i < 10000; ++i)
|
for (int i=0; mBlocking == PR_TRUE && i < 10000; ++i)
|
||||||
{
|
{
|
||||||
gtk_main_iteration_do(TRUE);
|
gtk_main_iteration_do(TRUE);
|
||||||
@ -293,6 +293,9 @@ nsresult nsSelectionMgr::PasteTextBlocking(nsString *aPastedText)
|
|||||||
|
|
||||||
mBlocking = PR_FALSE;
|
mBlocking = PR_FALSE;
|
||||||
|
|
||||||
|
if (!mSelectionData.data)
|
||||||
|
return NS_ERROR_NOT_AVAILABLE;
|
||||||
|
|
||||||
*aPastedText = (char*)(mSelectionData.data);
|
*aPastedText = (char*)(mSelectionData.data);
|
||||||
g_free(mSelectionData.data);
|
g_free(mSelectionData.data);
|
||||||
mSelectionData.data = nsnull;
|
mSelectionData.data = nsnull;
|
||||||
@ -314,6 +317,9 @@ void
|
|||||||
nsSelectionMgr::SelectionReceiver (GtkWidget *aWidget,
|
nsSelectionMgr::SelectionReceiver (GtkWidget *aWidget,
|
||||||
GtkSelectionData *data)
|
GtkSelectionData *data)
|
||||||
{
|
{
|
||||||
|
mBlocking = PR_FALSE;
|
||||||
|
mSelectionData.data = nsnull;
|
||||||
|
|
||||||
if (data->length < 0)
|
if (data->length < 0)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_akkana
|
#ifdef DEBUG_akkana
|
||||||
@ -329,7 +335,6 @@ nsSelectionMgr::SelectionReceiver (GtkWidget *aWidget,
|
|||||||
mSelectionData.data = g_new(guchar, data->length + 1);
|
mSelectionData.data = g_new(guchar, data->length + 1);
|
||||||
memcpy(mSelectionData.data, data->data, data->length);
|
memcpy(mSelectionData.data, data->data, data->length);
|
||||||
mSelectionData.data[data->length] = '\0';
|
mSelectionData.data[data->length] = '\0';
|
||||||
mBlocking = PR_FALSE;
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user