Author Topic: ClearCase Plug-In  (Read 30439 times)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: ClearCase Plug-In
« Reply #15 on: October 30, 2005, 06:44:40 pm »
I allocate my wxMenu (for the submenu) now at constructor time
Not good. When the popup menu is closed, your wxMenu is freed. Allocate inside BuildModuleMenu.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: ClearCase Plug-In
« Reply #16 on: October 30, 2005, 06:51:12 pm »
So that means that if you allocate a submenu, you don't need to free/delete it in case of the "context menu", this is done automatically ??

Does this also apply for submenus generated in an exisisting menu (for example a submenu one has created and addedt to let's say the "Edit" menu ??

Trying out your hint right now.

Thanks,
lieven
« Last Edit: October 30, 2005, 06:54:03 pm by killerbot »

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: ClearCase Plug-In
« Reply #17 on: October 30, 2005, 07:08:26 pm »
Thanks Thomas,

It works. Good to know this, since it is a bit surprising that you loose ownership.

It is strange that I did not get a crash when I close cb, since in my destructor I checked my 'sub'menu pointer, and if it is still != NULL I delete it. So taking into account your words, I would have been a second delete.

This whole stuff might be dangerous, since I allocate (in my dll), it get's freed in another dll/exe I guess, the application in charge of the menu ?? What if both are build differently, release build <---> debug build. I know for example in M$ Dev Studio, one had to make sure alloc/free had to originate from the same flavour(debug,release, single/multi-thread).

As I see it here, this danger is lurking at us.

I think it would have been better that the Append/Insert/Prepend of a submenu would have been done by a pointer pointer, in that way you could check on the 'pointer' to be NULL or not, so if it got allocated by someone else they could have set the value of the pointer to NULL, and one could check through *pointerpointer. Pff, always suspicous for memory leaks. :?

Or event better, if you want to append a (sub)menu, wx could create it on the inside, then ownership did not have to be transfered, and alloc/free could happen in the same environment. And you could get a handle back for adding the entries.

But these are wx issued not cb's.


kind regards,
Lieven

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: ClearCase Plug-In
« Reply #18 on: October 30, 2005, 07:53:10 pm »
So that means that if you allocate a submenu, you don't need to free/delete it in case of the "context menu", this is done automatically ??
Never delete anything that you pass to a wxWidgets GUI container (and your menu is passed to wxWidgets in the end, obviously).
This is not only unnecessary, it is detrimental, because the same object may be freed twice, which is an undefined operation.

Edit:
In almost every case, you can pass an object to wxWidgets, and it will make silently a copy for its own. There are very few exceptions (and unluckily, I don't remember them). That way, you have your object on the stack and don't need to care about allocation anyway, when it goes out of scope, it's gone.
« Last Edit: October 30, 2005, 07:56:05 pm by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: ClearCase Plug-In
« Reply #19 on: October 31, 2005, 01:07:54 am »
This is not only unnecessary, it is detrimental, because the same object may be freed twice, which is an undefined operation.

Yeah. We've had MANY crashing problems with Codeblocks because of objects deleted twice. Have to be VERY VERY careful there.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: ClearCase Plug-In
« Reply #20 on: November 04, 2005, 03:26:06 pm »
Dear all,

The first beta of my ClearCase plug-in is available (see attachment).
If you don't know what ClearCase is, you probably don't need it (well you might but then you need to buy ClearCase first which is expensive).


OS/Evironment :
Windows (peferrably XP), sorry linux guys
Code::Blocks RC2
ClearCase (only been tested with snapshot views)

Install :
---------
1) copy the ClearCase.zip from the ClearCaseProject.zip to <CodeBlocks-instal-dir>\share\CodeBlocks
2) copy the clearcase.dll from the ClearCaseProject.zip to <CodeBlocks-instal-dir>\share\CodeBlocks\plugins
3) make sure the bin directory of clearcase is in your path (this is normally the case when you installed ClearCase)

Usage:
---------
- ClearCase functionality is available from the ClearCase menu (top menu bar, next to the Help menu) and when right clicking in the editor (submenu ClearCase)

- you can checkout/checkin/undo checkout a file (the current editor file), watch the version tree of that file, compare it with it's previous version, update it

- view the config spec of your view, update the view

- browse labels and branches in the current vob (determined for the moment on the current open file) (NOTE : in the next beta if no file is open it will be determined based upon the path of the project)

- Find your checkouts

- Start the ClearCase exporer and the Apply Label wizard

During checkout/check-in a dialog box will pop up allowing you to specify comments for your operation, and for an undo checkout out you can specify to have a keep version.
Several commands will provide feedback on the operation (sometimes together with some debug info) in the newly created ClearCase tab in the Messages panel.


The attached zip file also contains the source code, though it needs a clean up, some debug info is still visible. But tomorrow I am leaving for Las Vegas for the c++ devconnections and I wanted to have the first beta out. Second beta will be cleaned up, a tutorial for plug-in writing will be derived from it and some more functionality will be added.



I hope you enjoy it.

kind regards,
Lieven

[attachment deleted by admin]

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: ClearCase Plug-In
« Reply #21 on: November 04, 2005, 03:51:09 pm »
Although I have no use for it, thanks a lot for the contribution Lieven :)
Be patient!
This bug will be fixed soon...

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: ClearCase Plug-In
« Reply #22 on: July 07, 2008, 01:21:39 pm »
Dear All,

I have finally updated the plug-in :

* CB 8.02 or later compatible
* extra commands (also on project tree level)
* branching (to killerbot's project structure ;-) )
* advanced labeling (to killerbot's project structure ;-) )
* things I am forgetting

NOTE : drop the .zip extension first (added to be able to attach to this post)

Enjoy

[attachment deleted by admin]

Offline lexis

  • Multiple posting newcomer
  • *
  • Posts: 36
Re: ClearCase Plug-In
« Reply #23 on: July 08, 2008, 10:46:12 pm »
Hi killerbot

Is it possible to get src? I would like try to build it with with latest CB ver...

Thanks a lot :-)

Offline coder

  • Single posting newcomer
  • *
  • Posts: 4
Re: ClearCase Plug-In
« Reply #24 on: July 10, 2008, 08:25:34 pm »
too late  :), i have added basic clearcase calls (check in, check out, version tree, compare .....) to the "Tools" menu.
In attach my default.conf (located in the "C:\Documents and Settings\username\Application Data\codeblocks\")
in the <tools> tag you will see all CC stuff.


[attachment deleted by admin]

Offline lexis

  • Multiple posting newcomer
  • *
  • Posts: 36
Re: ClearCase Plug-In
« Reply #25 on: July 14, 2008, 12:34:13 pm »
Yes, I know this way.
But it will be nice
1. To see status of files under ClearCase from project manager
2. To have customised set of commands in menu according to a file status (checked in/out / private)
3. There is no way to have a complex structure in the tools menu...

So it's still actual target to develop the CC plugin :-)

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: ClearCase Plug-In
« Reply #26 on: July 14, 2008, 12:42:52 pm »
1. To see status of files under ClearCase from project manager
Do you mean by different icons ?? That's (currently ) not so easy :-(


2. To have customised set of commands in menu according to a file status (checked in/out / private)

I have implemented this once, but it gave serious issues, hanging CB. I will try it again coming weeks, maybe I can fix it now.

Offline lexis

  • Multiple posting newcomer
  • *
  • Posts: 36
Re: ClearCase Plug-In
« Reply #27 on: July 14, 2008, 01:00:14 pm »
to killerbot
You are right
And with the CC plugin it is still possible, but with the Tools menu - not :-)

A space to enchancement is another reason to see the sources! ;-)

vince

  • Guest
Re: ClearCase Plug-In
« Reply #28 on: November 24, 2010, 02:38:30 pm »
Hi killerbot,
Your plugin looks excellent!
Can you tell me where can I find the file ClearCaseProject.zip?
It's not attached to the post.
Thanks,
Vince

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: ClearCase Plug-In
« Reply #29 on: November 24, 2010, 03:04:27 pm »
Hi killerbot,
Your plugin looks excellent!
Can you tell me where can I find the file ClearCaseProject.zip?
It's not attached to the post.
Thanks,
Vince
send me your email address, I will look up the zip file this weekend on my computers and will email it to you.
Might be the plug-in needs to be recompiled, due to all the changes in CB. IF needed I will do that to, but then it might take a little bit longer ...