[wx-dev] [ wxwindows-Bugs-1948752 ] wxRichTextCtrl - Clipboard with
old data
SourceForge.net
noreply at sourceforge.net
Sat May 3 12:07:47 PDT 2008
Bugs item #1948752, was opened at 2008-04-22 13:00
Message generated for change (Comment added) made by juliansmart
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1948752&group_id=9863
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: RichTextCtrl
>Group: Not a bug
>Status: Closed
Resolution: None
Priority: 3
Private: No
Submitted By: LAgY (lagy)
Assigned to: Julian Smart (juliansmart)
Summary: wxRichTextCtrl - Clipboard with old data
Initial Comment:
Hello,
When copying/cutting text from wxRichTextCtrl and then closing program, clipboard appears to be with old data. I think this update should fix the problem:
---------FILE:richtextbuffer.cpp LINE:5758
if (wxTheClipboard->SetData(compositeObject))
{
wxTheClipboard->Flush(); //Flush clipboard
success = true;
}
wxTheClipboard->Close();
Thanks in advance
----------------------------------------------------------------------
>Comment By: Julian Smart (juliansmart)
Date: 2008-05-03 19:07
Message:
Logged In: YES
user_id=59495
Originator: NO
Perhaps, if there's an overhead associated with Flush, then we should
leave it to the application to call Flush when it exits. Besides, we can't
guess whether this is desirable for every application. So for now I'll
close this bug.
----------------------------------------------------------------------
Comment By: LAgY (lagy)
Date: 2008-04-23 17:54
Message:
Logged In: YES
user_id=2069557
Originator: YES
Although I am not the expert, but i can't see any memory leak with
Flush(). To be sure I have created small program which adds a lot of data
to the clipboard several times and the memory usage was not unexpectedly
large. Please, write if I am wrong.
void ClipTest::OnBtnClick(wxCommandEvent& event){
wxFFile fp(wxT("test.txt"), wxT("r")); //file size is 2097152 B = 2 MB
if(!fp.IsOpened()){
wxMessageBox(wxT("Err (1)"));
return;
}
wxString str;
fp.ReadAll(&str);
fp.Close();
for(int i=0;i<1000;i++){
if(wxTheClipboard->Open()){
wxTheClipboard->Clear(); //also tried without Clear()
if(!wxTheClipboard->SetData(new wxTextDataObject(str)))
wxMessageBox(wxT("Err (2)"));
if(!wxTheClipboard->Flush()) wxMessageBox(wxT("Err (3)"));
wxTheClipboard->Close();
}else wxMessageBox(wxT("Err (4)"));
}
}
----------------------------------------------------------------------
Comment By: Robin Dunn (robind)
Date: 2008-04-22 19:55
Message:
Logged In: YES
user_id=53955
Originator: NO
My understanding is that every time Flush is called the app releases it's
hold on the memory of the data object, and that memory will be leaked. If
that is still the case then we certainly don't want to do that for every
cut or copy operation.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1948752&group_id=9863
More information about the wx-dev
mailing list