Author Topic: wxMDIChildFrame crash  (Read 22419 times)

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
wxMDIChildFrame crash
« on: April 20, 2005, 03:40:22 pm »
Hi,

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

Code: [Select]

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


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 ?

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
wxMDIChildFrame crash
« Reply #1 on: April 20, 2005, 09:06:32 pm »
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.

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
wxMDIChildFrame crash
« Reply #2 on: April 20, 2005, 11:08:56 pm »
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

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
wxMDIChildFrame crash
« Reply #3 on: April 21, 2005, 07:19:20 am »
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?

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
wxMDIChildFrame crash
« Reply #4 on: April 21, 2005, 08:31:06 am »
Quote
Obviously we need to adapt EditorManager to handle special non-editor cases... Yiannis, any ideas of how to handle this?

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

Yiannis.
Be patient!
This bug will be fixed soon...

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
wxMDIChildFrame crash
« Reply #5 on: April 21, 2005, 10:57:08 am »
I've found it too, hope You'll be able to fix that soon :)

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
wxMDIChildFrame crash
« Reply #6 on: April 21, 2005, 03:35:07 pm »
OK, the changes are in CVS :)
After you update your CVS copy and build it, get a test plugin I hacked quickly to test it.

Yiannis.
Be patient!
This bug will be fixed soon...

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
wxMDIChildFrame crash
« Reply #7 on: April 21, 2005, 05:00:24 pm »
:D Yuppi, it works !

Thx a lot for your help

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
wxMDIChildFrame crash
« Reply #8 on: April 21, 2005, 05:41:28 pm »
Just don't forget to keep us posted on your progress :D

Yiannis.
Be patient!
This bug will be fixed soon...

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
wxMDIChildFrame crash
« Reply #9 on: April 22, 2005, 09:23:58 am »
Heh, Let's confess :)

I'm working on some RAD tool (yes, the one that would help building wxwidgets forms) but I started writing it from scratch (yep, I've seen Bounty: Formbuilder but in my opinion it won't be easy to fully integrate it with C::B - real time code generation etc.. but it's only my opinion  :wink:) and rather for educational purposes, and it's very probable that it won't be anything interesting  :?

But why not try :wink:

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
wxMDIChildFrame crash
« Reply #10 on: April 22, 2005, 11:10:38 pm »
YAY! :D I'm so glad!

Note: Why not use templates or something to change the code?

Like //#begin:something
(object definitions here)
//#end:something

And of course, why not to xrc? It's much easier to manage - of course, knowing your have to use xml...

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
wxMDIChildFrame crash
« Reply #11 on: April 23, 2005, 01:52:11 pm »
Quote from: rickg22
Note: Why not use templates or something to change the code?

Like//#begin:something
(object definitions here)
//#end:something


Basically it will be based in something like this, the main problem I've found while testing wxFormBuilder was that it was generating whole class (with additional note that files with generated code shouldn't be modified outside) - so using it would mean parsing, splitting into some pieces and then putting modified parts inside real code. Huh, a lot of work...

Quote

And of course, why not to xrc? It's much easier to manage - of course, knowing your have to use xml...


Using XRC is very good idea but my dream is to create editor which would be easily extensible (such extensibility was used f.ex. in C::B  :wink: ) and I'm not sure if XRC allows it

...just imagine that You need some database components but wxWidgets are not providing tools You need, just few clicks and You have new widget downloaded directly from internet, fully integrated with Your project...

ok, back to the reality. I'm planning to use XRC but first I need to supply something that would work in any way.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
wxMDIChildFrame crash
« Reply #12 on: May 12, 2005, 09:29:27 pm »
Hey byo! Got a work for you. Someone is donating some resource editor program to Code::Blocks, and I'd like you to work on the plugin. Please see the "RAD Developers wanted" thread on the developers forums.

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
wxMDIChildFrame crash
« Reply #13 on: May 19, 2005, 03:27:33 pm »
Quote from: rickg22
Hey byo! Got a work for you. Someone is donating some resource editor program to Code::Blocks, and I'd like you to work on the plugin. Please see the "RAD Developers wanted" thread on the developers forums.


Yep, already working on it, but had to leave it up till now. Now I'm back and will try do do my best :). Here's proove that i'm not kidding:


Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
wxMDIChildFrame crash
« Reply #14 on: May 19, 2005, 04:03:04 pm »
Byo,

I 'm amazed  :shock:  :D

Yiannis.
Be patient!
This bug will be fixed soon...