Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: byo on April 20, 2005, 03:40:22 pm

Title: wxMDIChildFrame crash
Post by: byo 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

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 ?
Title: wxMDIChildFrame crash
Post by: rickg22 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.
Title: wxMDIChildFrame crash
Post by: byo 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
Title: wxMDIChildFrame crash
Post by: rickg22 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?
Title: wxMDIChildFrame crash
Post by: mandrav 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.
Title: wxMDIChildFrame crash
Post by: byo on April 21, 2005, 10:57:08 am
I've found it too, hope You'll be able to fix that soon :)
Title: wxMDIChildFrame crash
Post by: mandrav 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 (http://www.codeblocks.org/tmp/test_plugin.zip) I hacked quickly to test it.

Yiannis.
Title: wxMDIChildFrame crash
Post by: byo on April 21, 2005, 05:00:24 pm
:D Yuppi, it works !

Thx a lot for your help
Title: wxMDIChildFrame crash
Post by: mandrav on April 21, 2005, 05:41:28 pm
Just don't forget to keep us posted on your progress :D

Yiannis.
Title: wxMDIChildFrame crash
Post by: byo 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:
Title: wxMDIChildFrame crash
Post by: rickg22 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...
Title: wxMDIChildFrame crash
Post by: byo 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.
Title: wxMDIChildFrame crash
Post by: rickg22 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.
Title: wxMDIChildFrame crash
Post by: byo 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:

(http://knysza.t19.ds.pwr.wroc.pl/~byo/codeblocks/smith.jpg)
Title: wxMDIChildFrame crash
Post by: mandrav on May 19, 2005, 04:03:04 pm
Byo,

I 'm amazed  :shock:  :D

Yiannis.
Title: wxMDIChildFrame crash
Post by: rickg22 on May 19, 2005, 06:04:43 pm
I'm also amazed, but not only at byo's work. I'm more amazed at how the Code::Blocks development is becoming more and more community-driven. i.e. frog-o is working on the tabbed interface, and byo's working on the plugin for a RAD who was also donated by someone in the community (upCase) !!
Indeed, we're working bottom-up. Two thumbs up, byo! :) And congratulations all :)
P.S. Should we rename this thread to "RAD Editor plugin"?
Title: wxMDIChildFrame crash
Post by: frog-o on May 20, 2005, 01:59:30 pm
Here something i want to see.   I want to upload more of ower work in progress stuff in form of patches to a contrib dir so we are not recodeing someone else work.  For example, i would like to upload my work on wxnotebook that uses xrc to cvs so some one can help track down bug .  If someone want to convert it to say text base widgets creation so we can upload a wxnotebook editor to the main tree this would be welcome and a big beniffet.
Title: wxMDIChildFrame crash
Post by: DreadNot on May 20, 2005, 07:13:56 pm
Whahoo!!!
Add me on to this for development! Me too, Me too, please!
Tell me what I can do!

DreadNot
Title: wxMDIChildFrame crash
Post by: rickg22 on May 20, 2005, 08:03:49 pm
Argh! So many works in progress that can't be uploaded! :(
But fear not, dreadnot :-P I think there's a possible solution:

We could create in CVS some new branches, _AND_ a contrib dir:

i.e. a "notebook" branch for non-MDI interface,
and a contrib dir in the "trunk" (main branch) for plugins, etc.

Yiannis, what do you think? Is it time to give frog-o and byo CVS access?
Title: wxMDIChildFrame crash
Post by: byo on May 20, 2005, 08:51:58 pm
Yay, this project is going to grow... rapidly grow. An maybe all my dreams about free, powerfull, potrable and great IDE will come true :D

Huh, gotta finish my study project (of course will write it in C::B) and will do my best to support C::B with RAD tool :D.

Oh, by the way. In my opinion there are two reasons making C::B some kind of speccial:
Basing it on wxWidgets library (great,  commercially free and PORTABLE stuff) and
great plugin system - giving the community a chance to support this IDE with their work

Yep, this will be something HUGE

Thx for C::B  :D
Title: wxMDIChildFrame crash
Post by: mandrav on May 21, 2005, 10:00:28 am
Quote
Yiannis, what do you think? Is it time to give frog-o and byo CVS access?

If byo is interested, we could give him a CVS directory to work in it.

frog-o 's case is somewhat different as he 's not developing a plugin, but rather working on the main code.
frog-o should provide patches when he 's ready. These patches will be reviewed and, if accepted, will be applied in CVS.

CVS-write access to the main code is earned, not given away.

It's like when you, Rick, wanted to join. You worked on your local CVS copy of C::B and provided patches which I reviewed and then applied in CVS. When I saw that we can work together, I happily granted you CVS-write access.
The same goes for frog-o and anyone else interested to join.

It's only different for plugin writers. They 're given CVS-write access to a specific folder to work on their plugin. This way they 'll attract more developers since the code will be in the main C::B repository instead of their hard drive, so many more eyes will get to look at it ;)

A note to frog-o:
I appreciate all the hard work you 're doing, but I think you 're trying to do too many things at once (notebook, xrc, etc). I believe it would be better to do one thing at a time. For example, work on converting MDI to notebook and when you 're done, send me a patch for it. Then continue with the next thing on your checklist (like xrc for main).
It's easier for you to debug your code this way and for me to review the patch...

Yiannis.
Title: wxMDIChildFrame crash
Post by: frog-o on May 21, 2005, 06:54:53 pm
thank you for the comment mandrav.   I do have the habbit of trying to do to much ate one time but this time i think it is diferent.  Could you please look at the new post on my Question on codeblock desine section. I don't want to take to much attion of of his tred talking about my project so I post there.
There alot of post you have not read or a least replyed to.
Please note i want to earn the respect anyway.  I Going over to my tread now and add even more info.
thank frog-o
Title: wxMDIChildFrame crash
Post by: byo on May 21, 2005, 08:53:23 pm
Hello, my proposition for my CVS acces is as follows:
Currently my plugin is very unstable so it could be harmful to merge it with current repository. This could result in troubles with C::B dedevelopment and suggest for all people compiling C::B from CVS that this IDE is very unstable. But if anyne want source for my plugin (I've named it wxSmith :) ) I can share with all I have written already and it could be merged with cvs when first symptoms of stability will be seen :wink:
Hmm, maybe I just case too much  :wink:
What's Your opinion ?
Title: wxMDIChildFrame crash
Post by: mandrav on May 21, 2005, 09:00:58 pm
Quote
Currently my plugin is very unstable so it could be harmful to merge it with current repository.

Never mind that. I have created a plugins/contrib folder for third-party plugins. These are not distributed with C::B nor compiled by default (they have their own project file).
This means that whoever uses these plugins are essentially on their own, and support must be asked by the plugin's author. This allows for people interested on a particular third-party plugin, to take part in the development process. The essence of open source ;)
Of course, the contributed plugin will get its place in the bug report system and the author will be responsible for it.
When the plugin reaches a usable (and well-tested) state, it can be moved to the main C::B system and actually be a part of C::B distribution.

So, just ask for it :)

Yiannis.
Title: wxMDIChildFrame crash
Post by: byo on May 22, 2005, 02:37:35 pm
In such case I have no reason to be against my CVS access :)
Title: wxMDIChildFrame crash
Post by: mandrav on May 22, 2005, 05:48:21 pm
Quote
In such case I have no reason to be against my CVS access

Send me a zip of your files and your sourceforge.net account name.

Yiannis.
Title: wxMDIChildFrame crash
Post by: byo on May 23, 2005, 08:46:23 am
Sent yesterday. Hope You've got it already, Yannis :)