Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

wxMDIChildFrame crash

(1/6) > >>

byo:
Hi,

I tried to make some test plugin which uses wxMDIChildFrame, the only changes made after plugin wizard are:


--- Code: ---
void wxMDITest::OnAttach()
{
new wxMDIChildFrame(Manager::Get()->GetAppWindow(),-1,"Test");
}

--- End code ---


While activating this MDI child, Code::Blocks crashes. I've compiled Code::Blocks by myself everything should be ok, other things like adding new pages to notebooks are working...

What I'm doing wrong ?  :?

Can anybody help me ?

rickg22:
Yay! You're writing a plugin! :D

OK. First thing... you need to debug code::blocks.
*AND* you need to download the Code::Blocks sourcecode.  My suspicion (warning: most of the time my suspicions are wrong, ask Yiannis  :oops: ) is that somewhere in the code, Code::Blocks mistakes your childframe with a cbEditor window. :-/

So the only way to know what's happening is to compile codeblocks, put your plugin in the *development* directory of the project (it's src/devel/share/codeblocks), and debug.

(Yes, you need *TWO* copies of codeblocks. One's the version you downloaded and another one is the one you're compiling. You use the working version to debug the developing version.

Hope that helps.

byo:
Yep. I'm writing a plugin, at least I'm trying to ;)

I got the sourcecode of code::blocks, my second - plugin-testing - copy.
Your suspicions are probably right, when I added cpEditor in my test plugin everything was ok (even though I could't close that window it was displaying and working properly).

So, let's debug... maybe there will be some nice bug report soon  :P

rickg22:
I found it.

editormanager.cpp:

cbEditor* EditorManager::GetActiveEditor()
{
    SANITY_CHECK(0L);
    wxMDIParentFrame *appwindow =Manager::Get()->GetAppWindow();
    if(!appwindow) return 0; // prevents segfault
    return static_cast<cbEditor*>(appwindow->GetActiveChild());
}

Obviously we need to adapt EditorManager to handle special non-editor cases... Yiannis, any ideas of how to handle this?

mandrav:

--- Quote ---Obviously we need to adapt EditorManager to handle special non-editor cases... Yiannis, any ideas of how to handle this?
--- End quote ---

Yes, I have something in mind. Let me run some tests first and then I 'll come back to you.

Yiannis.

Navigation

[0] Message Index

[#] Next page

Go to full version