wxAuiManager, bug in AddPane, 2.8.3

Friedrich Haase Friedrich_Haase at compuserve.com
Mon Apr 2 14:35:34 PDT 2007


Moin all,

wxWidgets 2.8.3
I think there is a bug in wxAuiManager.

Symptome:
wxAuiPaneInfo& wxAuiManager::GetPane(wxWindow* window)
wxAuiPaneInfo& wxAuiManager::GetPane(const wxString& name)
behave different. The first function will find the window as expected. But
the second function using the window name will not.

GetPane(const wxString& name)
compares the names in wxAuiPaneInfo m_panes by
if (p.name == name)

But p.name contains artifical names like
(p).name == "00e75de8461161ef0000021300000001"
which have been build from the window pointer an other stuff

The window name hasn't been used twice and the window at p.window has the 
expected name.

The error is in AddPane in framemanager.cpp after line 833
bool wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& pane_info)

AddPane ALWAYS constructs the artifical name instead of using the name of 
the given window (except if window does not have a name or it has been used 
again).

I think the following modification to AddPane could solve the problem

    // check if the pane name already exists, this could reveal a
    // bug in the library user's application
    bool already_exists = false;
-   if (!pane_info.name.empty() && GetPane(pane_info.name).IsOk())
+   if (pane_info.name.empty())
+      pane_info.name = window.name;
+   if (GetPane(pane_info.name).IsOk())
    {
        wxFAIL_MSG(wxT("A pane with that name already exists in the 
manager!"));
        already_exists = true;
    }

If the window has a name it should be used. Multiple usage will set 
already_exists. A few lines down an empty name in window or a multiple used 
name will correctly change to pane info name to an artificial one.

The other 2 variants will profit from this modification. No action required.

Is there anybody who could check this and possibly update framemanager.cpp?

Friedrich Haase


Ingenieurbüro Dr. Friedrich Haase
Consulting - Automatisierungstechnik
web        http://www.61131.com/





More information about the wx-users mailing list