The wxGTK clipboard multiply-connects
|Reported by:||dghart||Owned by:||vadz|
(Skip this paragraph unless you want the background) CodeLite is a multi-tab IDE, each tab containing a wxStyledTextCtrl. For a year or more I'd noticed that, once I'd been using an instance for a week or two, actions like changing tabs got slower and slower until the instance became unusable. The wasn't easy to debug (Step 0: Run the app for 2 weeks...). Recently a new CodeLite plugin improved the situation: it slows things in an hour or so, and I've been able to track it down to the wxGTK clipboard.
Apply stctest.diff and run the stc sample. Ideally load a long file e.g. src/richtext/richtextbuffer.cpp. Calling the 'About' dialog will select all the text 200 times. Look at the wxLogDebug output (and listen to your cpu fan) and you'll see things progressively slow. Keep calling the dialog; it slows even more.
On interrupting, the backtrace (see bt.txt) was always in src/common/strconv.cpp:wxMBConvStrictUTF8::FromWChar, but this and the calling functions seemed innocent. I finally realised that it wasn't slow; it's just being called increasingly often. Uncomment the wxLog::AddTraceMask line (304) in the stc sample to demonstrate this.
The problem is that each time wxClipboard::AddData in src/gtk/clipbrd.cpp is called, it does g_signal_connect (m_clipboardWidget, "selection_get",....); I have little gtk knowledge and there's probably a better solution, but clipbrd.diff uses a static bool to restrict this to once. This makes the stc sample behaves normally, and there are no obvious regressions or relevant test failures.
Change History (5)
comment:1 in reply to: ↑ description Changed 4 years ago by vadz
- Owner set to vadz
- Status changed from new to accepted