Author Topic: Hunting and solving multiple bugs in wxSmith, mostly with wxSizer inside wxAUI.  (Read 3818 times)

Offline ivan braga

  • Multiple posting newcomer
  • *
  • Posts: 15
Moderator, if not the appropriate place, feel free to resolve.

In order to help anyone who is experiencing the same problems, I hope this can help solve if they are the same problems I had.

I believe everything is a bug in the wxSmith plugin.

I created a simple project to be able to show what I was having of errors, and how to solve them.

Using the wxSmith plugin, I created a window and put a "wxAuiManager" inside it, and in the sequence I added 02 wxPanel, as you can see in the image, gave the command to compile and run.



Error 1:

Below the information inside the BACKTRACE and the window itself, because this window also has a bug, does not resize to let you see all the information.

Code
ASSERT INFO:
../src/aui/framemanager.cpp(1012): assert ""Assert failure"" failed in AddPane(): A pane with that name already exists in the manager!

BACKTRACE:
[1] wxAuiManager::AddPane(wxWindow*, wxAuiPaneInfo const&)
[2] wxEntry(int&, wchar_t**)
[3] wxEntry(int&, char**)
[4] __libc_start_main



To resolve, just correct the name in the "AUI Name" field.







Error 2:

Error is old for what I've been searching. Solution below the image.

Code
ASSERT INFO:
../src/common/wincmn.cpp(477): assert "GetEventHandler() == this" failed in ~wxWindowBase(): any pushed event handlers must have been removed

BACKTRACE:
[1] wxWindowBase::~wxWindowBase()
[2] wxWindow::~wxWindow()
[3] wxNonOwnedWindow::~wxNonOwnedWindow()
[4] wxTopLevelWindowBase::~wxTopLevelWindowBase()
[5] wxTopLevelWindowGTK::~wxTopLevelWindowGTK()
[6] wxFrameBase::~wxFrameBase()
[7] wxAppConsoleBase::DeletePendingObjects()
[8] wxAppConsoleBase::ProcessIdle()
[9] wxAppBase::ProcessIdle()
[10] wxApp::DoIdle()
[11] g_main_context_dispatch
[12] g_main_loop_run
[13] gtk_main
[14] wxGUIEventLoop::DoRun()
[15] wxEventLoopBase::Run()
[16] wxAppConsoleBase::MainLoop()
[17] wxAppConsoleBase::OnRun()
[18] wxAppBase::OnRun()
[19] wxEntry(int&, wchar_t**)
[20] wxEntry(int&, char**)
[21] __libc_start_main



Just add AuiManager1-> UnInit (); in the destructor.

Code
pjtWxMiscelaniaFrame::~pjtWxMiscelaniaFrame()
{
    //(*Destroy(pjtWxMiscelaniaFrame)
    //*)
    AuiManager1->UnInit();
}

Error 3:

I added the 02 buttons on the first wxPanel, the left "Pane caption 1", gave the command to compile and run.

No problems.



Then I added another 2 buttons inside a wxSizer in the second wxPanel to the right "Pane caption 2", gave the command to compile and run.

Compiled without error, but did not run.



This gave more work to find the solution.

Some time ago, I played around with wxFromBuilder a bit, and I did not have this problem.
So I recreated this program in wxFromBuilder, and compared the changes, of course respecting the differences between wxFromBuilder and wxSmith technologies.

Without much delay, the error was on line 83.
After marking this line as a comment, everything went well.
I believe that wxSmith is assigning the "BoxSizer1" indirectly to the main frame, as it can be seen, although it is not being declared directly there is an "this->" omitted here "SetSizer (BoxSizer1)".




It keeps track of these problems, as an aid for all and for myself when I forget this, also consult. 8)
« Last Edit: December 21, 2018, 07:40:35 am by ivan braga »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Thank you for reporting. Can you please open a ticket on SF so it wont get lost in the nirvana of this forum?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
ok, i created a ticket for this: https://sourceforge.net/p/codeblocks/tickets/789/
I have posted a patch with fixes for the first two in the ticket.