Hi there
Thanks for your detailed message. I am just back from a trip, I will look at 
this in the coming days. I would appreciate if you 
could create an entry in the bug tracker for each bug (also possible if you do 
not have a SF account):
http://sourceforge.net/tracker/?func=add&group_id=51305&atid=462816
Regards,
Ronan


----- Original Message ----- 
From: "Yaroslav" <[EMAIL PROTECTED]>
To: <wxcode-users@lists.sourceforge.net>
Sent: Thursday, 04 September, 2008 20:04
Subject: [wxCode-users] Bugs in wxTreeListCtrl


> Hi,
>
> Thanks for the wxTreeListCtrl.
>
> There are two bugs in your code that break "Edit Label" functionality.
>
> Bug 1. After several renames, I get either intermittent crashes or failure of
> the Edit control to show and work properly.
>
> The bug is due to the usage of a deleted object. Say, we're editing a label 
> and
> hit ENTER. In the OnChar handler, the edit control is marked for some
> asynchronous deletion, and then m_finished flag is set.
>
>
> void wxEditTextCtrl::OnChar( wxKeyEvent &event )
> {
>    //...
>    if (event.GetKeyCode() == WXK_RETURN)
>    {
>        if (!wxPendingDelete.Member(this))
>            wxPendingDelete.Append(this);
>
>        m_finished = true;
>        // ...
>    }
>    // ...
> }
>
>
> At some point in time _later_, the destructor is called (because the object 
> has
> been pending for deletion), whicn in turn calls CancelEdit. CancelEdit exits
> immediately, because m_finished is set. So there's no chance that
> m_renameControl of the owner is reset to NULL.
>
>
> void wxEditTextCtrl::CancelEdit() {
>    if (m_finished) return;
>
>    // ...
>    if (m_owner) {
>        m_owner->OnRenameAccept(true);  // cancelled
>        if (m_owner->m_renameControl == this) {
>            m_owner->m_renameControl = NULL;
>            m_owner->m_editItem = NULL;
>        }
>        // ...
>    }
>
>    // ...
> }
>
>
> In the next EditLabel call, the following code will crash, because
> m_renameControl pointer is dangling.
>
>
>    if (m_renameControl) {
>        m_renameControl->CancelEdit();
>    }
>
>
> I patched this bug by moving the "m_owner->m_renameControl = NULL" above the 
> "if
> (m_finished) return;" in CancelEdit. The patch works for me but may be wrong 
> in
> some way; unfortunately, I don't have time to think it over and test it. So
> please fix this major bug as you see fit.
>
>
> Bug 2. After editing a label, I kill the focus of the edit control by clicking
> outside. If the click happens to land on one of the other tree-list columns,
> then that column gets updated with the new text, not the main column.
>
> Since I only need to edit the main column, I changed this line (in
> wxTreeListMainWindow::OnRenameAccept)
>
> SetItemText (m_editItem, m_curColumn, m_renameRes);
>
> to
>
> SetItemText (m_editItem, 0, m_renameRes);
>
> but this is not suitable when you need other columns, too. (I didn't 
> investigate
> this one.)
>
>
> There are other bugs (like crashing when removing a node with selection), 
> which
> I will report when I have the details.
>
>
> Thanks,
>
> Regards,
> Yaroslav.
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> wxCode-users mailing list
> wxCode-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wxcode-users 



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
wxCode-users mailing list
wxCode-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxcode-users

Reply via email to