Author Topic: annoying crash when debugging CC's auto-suggestion  (Read 44752 times)

Offline p2rkw

  • Almost regular
  • **
  • Posts: 142
Re: annoying crash when debugging CC's auto-suggestion
« Reply #15 on: July 24, 2013, 09:13:04 pm »
Quote
The autocomplete window in Scintilla is created each time but not destroyed.
Sorry, but I can't argee with that.
Here's how ListBox is created:
Code
void AutoComplete::Start(Window &parent, int ctrlID,
int position, Point location, int startLen_,
int lineHeight, bool unicodeMode, int technology) {
/* C::B begin */
// if (active) {
// Cancel();
// }
/* C::B end */
lb->Create(parent, ctrlID, location, lineHeight, unicodeMode, technology);
lb->Clear();
"lb->clear" calls ListBoxImpl::Create, here is part of it's implementation:
Code
/* C::B begin */
    if (wid == 0)
        wid = new wxSCIListBoxWin(GETWIN(parent.GetID()), ctrlID, location_);
    else if (GETLBW(wid)->GetParent() != GETWIN(parent.GetID()))
        GETLBW(wid)->Reparent(GETWIN(parent.GetID()));
    GETLBW(wid)->SetPosition(wxPoint(location_.x,location_.y));
    GETLBW(wid)->SetId(ctrlID);
    GETLB(wid)->SetId(ctrlID);
/* C::B end */
If window wasn't destroyed it will be reused.

At first I thought "How could I make so horrible mistake", but I look deeper into code and it's not so bad :)
« Last Edit: July 24, 2013, 09:20:08 pm by p2rkw »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: annoying crash when debugging CC's auto-suggestion
« Reply #16 on: April 03, 2014, 03:42:42 pm »
Hi, p2rkw, I just see a very similar crash issue happens (see the discussion in Re: The 22 March 2014 build (9744) is out.).

I think it is much like the one I reported.

Sorry that your patch is lost for one year. I think we need to fix them.
« Last Edit: April 03, 2014, 04:30:23 pm by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: annoying crash when debugging CC's auto-suggestion
« Reply #17 on: April 03, 2014, 03:59:48 pm »

(Another question is: how to build C::B which can link to a debug version of wxWidgets library, so that I can see/track the messages more clearly, currently, gdb's bt command always stop at [debug]#17 0x00e7ff27 in wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () from E:\code\cb\cleantrunk\src\devel\wxmsw28u_gcc_custom.dll)
Build options->Custom variables and probably you should define some wxdebug macros...

Today, I build the C::B which link against wx2.8.12 debug library to hunt a bug in Re: The 22 March 2014 build (9744) is out., here is the simple patch
Code
 src/CodeBlocks.cbp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/CodeBlocks.cbp b/src/CodeBlocks.cbp
index 07c384f..b456243 100644
--- a/src/CodeBlocks.cbp
+++ b/src/CodeBlocks.cbp
@@ -711,7 +711,7 @@
  </Target>
  <Environment>
  <Variable name="WX_CFG" value="" />
- <Variable name="WX_SUFFIX" value="u" />
+ <Variable name="WX_SUFFIX" value="ud" />
  <Variable name="WX_VERSION" value="28" />
  </Environment>
  </Build>
@@ -735,6 +735,7 @@
  <Add option="-DCB_PRECOMP" />
  <Add option="-DWX_PRECOMP" />
  <Add option="-DwxUSE_UNICODE" />
+ <Add option="-D__WXDEBUG__" />
  <Add directory="$(#WX.include)" />
  <Add directory="$(#WX.lib)/gcc_dll$(WX_CFG)/msw$(WX_SUFFIX)" />
  <Add directory="sdk/wxscintilla/include" />
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.