Code::Blocks

User forums => General (but related to Code::Blocks) => Topic started by: ivan braga on December 21, 2018, 07:28:14 am

Title: Hunting and solving multiple bugs in wxSmith, mostly with wxSizer inside wxAUI.
Post by: ivan braga on December 21, 2018, 07:28:14 am
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.

(https://i.imgur.com/3fuXG4o.png)

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: [Select]
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

(https://i.imgur.com/dNC1Ctk.png)

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

(https://i.imgur.com/9PMy1po.png)

(https://i.imgur.com/Bg8L5i2.png)



Error 2:

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

Code: [Select]
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

(https://i.imgur.com/XnZ8VU9.png)

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

Code: [Select]
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.

(https://i.imgur.com/I1lCauT.png)

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.

(https://i.imgur.com/9XLWk1h.png)

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)".

(https://i.imgur.com/ghqUICN.png)


It keeps track of these problems, as an aid for all and for myself when I forget this, also consult. 8)
Title: Re: Hunting and solving multiple bugs in wxSmith, mostly with wxSizer inside wxAUI.
Post by: BlueHazzard on January 06, 2019, 08:47:59 pm
Thank you for reporting. Can you please open a ticket on SF so it wont get lost in the nirvana of this forum?
Title: Re: Hunting and solving multiple bugs in wxSmith, mostly with wxSizer inside wxAUI.
Post by: BlueHazzard on January 20, 2019, 12:23:48 am
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.