Prevented open clipboard twice #4815
This commit is contained in:
parent
6e74655e78
commit
23739f8484
|
@ -314,7 +314,10 @@ XWindowsClipboard::add(EFormat format, const String& data)
|
||||||
bool
|
bool
|
||||||
XWindowsClipboard::open(Time time) const
|
XWindowsClipboard::open(Time time) const
|
||||||
{
|
{
|
||||||
assert(!m_open);
|
if (m_open) {
|
||||||
|
return false;
|
||||||
|
LOG((CLOG_DEBUG "failed to open clipboard: already opened"));
|
||||||
|
}
|
||||||
|
|
||||||
LOG((CLOG_DEBUG "open clipboard %d", m_id));
|
LOG((CLOG_DEBUG "open clipboard %d", m_id));
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@ IClipboard::unmarshall(IClipboard* clipboard, const String& data, Time time)
|
||||||
|
|
||||||
const char* index = data.data();
|
const char* index = data.data();
|
||||||
|
|
||||||
|
if (clipboard->open(time)) {
|
||||||
// clear existing data
|
// clear existing data
|
||||||
clipboard->open(time);
|
|
||||||
clipboard->empty();
|
clipboard->empty();
|
||||||
|
|
||||||
// read the number of formats
|
// read the number of formats
|
||||||
|
@ -60,6 +60,7 @@ IClipboard::unmarshall(IClipboard* clipboard, const String& data, Time time)
|
||||||
|
|
||||||
// done
|
// done
|
||||||
clipboard->close();
|
clipboard->close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String
|
String
|
||||||
|
@ -72,7 +73,7 @@ IClipboard::marshall(const IClipboard* clipboard)
|
||||||
std::vector<String> formatData;
|
std::vector<String> formatData;
|
||||||
formatData.resize(IClipboard::kNumFormats);
|
formatData.resize(IClipboard::kNumFormats);
|
||||||
// FIXME -- use current time
|
// FIXME -- use current time
|
||||||
clipboard->open(0);
|
if (clipboard->open(0)) {
|
||||||
|
|
||||||
// compute size of marshalled data
|
// compute size of marshalled data
|
||||||
UInt32 size = 4;
|
UInt32 size = 4;
|
||||||
|
@ -99,6 +100,7 @@ IClipboard::marshall(const IClipboard* clipboard)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clipboard->close();
|
clipboard->close();
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue