News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

annoying crash when debugging CC's auto-suggestion

Started by ollydbg, December 31, 2012, 10:21:54 AM

Previous topic - Next topic

p2rkw

#15
QuoteThe 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:
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:

/* 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 :)

ollydbg

#16
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.
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.

ollydbg

Quote from: oBFusCATed on December 31, 2012, 10:35:09 AM

Quote from: ollydbg on December 31, 2012, 10:21:54 AM
(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

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.