Berlin

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

Berlin

Postby theLizard » Sat Jun 25, 2016 9:51 pm

I am using a trial version of berlin while I wait for my license key to arrive from code partners. thought I would see how my components would compile, good thing is they compiled and installed with very little to do but, there is a big but so before starting to make any changes thought I would ask the questions.

When I drop a custom component on a form and not doing anything else, i attempt to delete using the delete button, berlin freezes, but appears to be with one component only so question is, how would i go about finding what the cause is.

Only had berlin for 2 days now...
theLizard
BCBJ Master
BCBJ Master
 
Posts: 447
Joined: Wed Mar 18, 2009 2:14 pm

Re: Berlin

Postby rlebeau » Sun Jun 26, 2016 1:46 pm

theLizard wrote:When I drop a custom component on a form and not doing anything else, i attempt to delete using the delete button, berlin freezes, but appears to be with one component only


Makes me think the component's destructor is doing something it should not be doing.

theLizard wrote:question is, how would i go about finding what the cause is.


Can you reproduce the freeze if you create and destroy the component in code at runtime? If so, then debugging the component directly is easy. But if not, you will likely have to debug the IDE itself instead. Run 2 instances of the IDE, where the first instance attaches its debugger to the second instance. Then you should be able to debug your component at design-time.
Remy Lebeau (TeamB)
Lebeau Software
User avatar
rlebeau
BCBJ Author
BCBJ Author
 
Posts: 1403
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

Re: Berlin

Postby theLizard » Sun Jun 26, 2016 6:08 pm

rlebeau wrote:Makes me think the component's destructor is doing something it should not be doing.


Yep, that was it, I suspected something like that, commented out a couple of things and problem has gone away.

Are there things I should look out for, for example should I include Vcl. in directives like (old) #include <StrUtils.hpp> (new) #include <Vcl.StrUtils.hpp> would this make any difference.

Cheers
theLizard
BCBJ Master
BCBJ Master
 
Posts: 447
Joined: Wed Mar 18, 2009 2:14 pm

Re: Berlin

Postby theLizard » Sun Jun 26, 2016 6:12 pm

rlebeau wrote:where the first instance attaches its debugger to the second instance.


Did not know you could do this, is this done via the attach to process option in Run? if not how would I go about doing that.
theLizard
BCBJ Master
BCBJ Master
 
Posts: 447
Joined: Wed Mar 18, 2009 2:14 pm

Re: Berlin

Postby rlebeau » Mon Jun 27, 2016 11:18 am

theLizard wrote:Yep, that was it, I suspected something like that, commented out a couple of things and problem has gone away.


Like what exactly?

theLizard wrote:Are there things I should look out for


Can't answer that since I can't see your code.

theLizard wrote:for example should I include Vcl. in directives like (old) #include <StrUtils.hpp> (new) #include <Vcl.StrUtils.hpp> would this make any difference.


There is no Vcl.StrUtils.hpp file. There is a System.StrUtils.hpp file instead, and StrUtils.hpp simply #include's System.StrUtils.hpp.

The "Vcl." unit scope prefix only applies to HPPs that are VCL-specific, to differentiate them from their FMX counterparts (eg, Vcl.Forms.hpp vs Fmx.Forms.hpp).

If you are targeting XE2+ only, you *should* use the unit scope prefixes in your #include's. If you need to target earlier versions, then don't bother, you can define the desired unit scopes in the Project Options of XE2+ projects so older projects don't fail to compile.
Remy Lebeau (TeamB)
Lebeau Software
User avatar
rlebeau
BCBJ Author
BCBJ Author
 
Posts: 1403
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

Re: Berlin

Postby theLizard » Mon Jun 27, 2016 3:48 pm

rlebeau wrote:Like what exactly?

deleting an object which was created in constructor.

rlebeau wrote:The "Vcl." unit scope prefix only applies to HPPs that are VCL-specific, to differentiate them from their FMX counterparts (eg, Vcl.Forms.hpp vs Fmx.Forms.hpp).


This is what I was looking for.

Cheers
theLizard
BCBJ Master
BCBJ Master
 
Posts: 447
Joined: Wed Mar 18, 2009 2:14 pm

Re: Berlin

Postby rlebeau » Mon Jun 27, 2016 4:14 pm

theLizard wrote:deleting an object which was created in constructor.


If you don't delete it, you might have a memory leak, depending on the nature of the object, if it has another owner who deleted it, etc. Don't just blindly change your code if you don't understand what the code is doing in the first place. You may be causing more problems then you solve. If you want to understand what the original code was doing, and why your change "fixes" it, then please show the actual code.
Remy Lebeau (TeamB)
Lebeau Software
User avatar
rlebeau
BCBJ Author
BCBJ Author
 
Posts: 1403
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

Re: Berlin

Postby theLizard » Mon Jun 27, 2016 4:36 pm

rlebeau wrote:If you don't delete it, you might have a memory leak, depending on the nature of the object, if it has another owner who deleted it, etc. Don't just blindly change your code if you don't understand what the code is doing in the first place. You may be causing more problems then you solve. If you want to understand what the original code was doing, and why your change "fixes" it, then please show the actual code.


I am not blindly changing code, I commented out the object being deleted to determine if that was causing the problem and since I do not yet have my license key and media disks to fully install berlin (problems with downloads as per previous post) I am waiting for berlin to be FULLY installed before I go about any real investigation into why the object was causing the problem, because it may not be the object itself but others that may be tied to it.

No point showing 1 line of code when the problem pay be elsewhere where the code that may is causing the problem is, as yet, not identified but will be.

Your suggestion regarding a second instance of debugger to debug will help achieve that so
theLizard wrote:is this done via the attach to process option in Run? if not how would I go about doing that


Cheers
theLizard
BCBJ Master
BCBJ Master
 
Posts: 447
Joined: Wed Mar 18, 2009 2:14 pm

Re: Berlin

Postby rlebeau » Sun Jul 03, 2016 12:51 pm

theLizard wrote:is this done via the attach to process option in Run?


That is one way to do it. Another way is to set the IDE as the Host executable for your component's package, and then Run it.
Remy Lebeau (TeamB)
Lebeau Software
User avatar
rlebeau
BCBJ Author
BCBJ Author
 
Posts: 1403
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

Re: Berlin

Postby theLizard » Thu Jul 07, 2016 2:01 am

rlebeau wrote:Another way is to set the IDE as the Host executable for your component's package, and then Run it


?? I have set the IDE as the Host Application (in Options->Debugger) but get lots of errors when when I try to run it (if that is what is required)

1st error EFOpenError
2nd error ESlipException
3rd error same as 1st

A new instance of the IDE is started.

4th error EIdSocketError
5th error EOdCouldNotBindSocket
6th error same as 4th
...

Step by step, how exactly can I debug my package using this method.

Also, I am getting some weird things going on, I am confident that migrating my components from 2010 to Berlin are causing some of the issues, one is having to Clean test apps every time I make a change to the code.

Everything compiles ok, warnings but no errors of any kind.

Another thing that is weird, I make changes to a place where I think the problem may be and even after uninstalling the package cleaning, recompile and install the break point I set is NOT reached, instead it steps into a blank line then skips the highlighted break point which is green and continues on!!!

I have even re-installed Berlin, am I the first with these problems!!!

Cheers
theLizard
BCBJ Master
BCBJ Master
 
Posts: 447
Joined: Wed Mar 18, 2009 2:14 pm

Re: Berlin

Postby HsiaLin » Thu Jul 07, 2016 5:00 am

theLizard wrote:Another thing that is weird, I make changes to a place where I think the problem may be and even after uninstalling the package cleaning, recompile and install the break point I set is NOT reached, instead it steps into a blank line then skips the highlighted break point which is green and continues on!!!

I have even re-installed Berlin, am I the first with these problems!!!

Cheers



I have had that blank line issue with every Builder edition since it went to XE#...one thing i can do to fix it is close the IDE, restart it and do a clean>compile>install and it seems to fix it for a while at least.
HsiaLin
BCBJ Master
BCBJ Master
 
Posts: 280
Joined: Sun Jul 08, 2007 6:29 pm

Re: Berlin

Postby rlebeau » Thu Jul 07, 2016 10:09 am

theLizard wrote:Step by step, how exactly can I debug my package using this method.


You are likely just seeing errors that are internal to the IDE (remember, a debugger sees all exceptions before the debugged process does). With the second IDE running, you can put breakpoints in your package code like any other project. When you drop your component onto the Form Designer, you should be able to debug its code, especially its constructor and destructor code.
Remy Lebeau (TeamB)
Lebeau Software
User avatar
rlebeau
BCBJ Author
BCBJ Author
 
Posts: 1403
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

Re: Berlin

Postby theLizard » Thu Jul 07, 2016 10:00 pm

rlebeau wrote: With the second IDE running


Ok, got this going and am able to step into code as you said and it is providing some answers (or not) I am at a loss as to why the OnEnter Event is not firing in one of my controls, I have been at this all day and still no closer to an answer so hoping you may be able to shed some light on it, below is the code for a CheckBox component derived from TCheckBox

In design mode I can set the caption no wories but when I run the test app, the caption of the Check Box is in void of cyber space, setting the caption in code works fine (shows) but when the check box gets the focus the OnEnter does not fire so cannot debug the code.

In Rad 2010, the same code has been running without issue for the last 4 - 5 years.
:evil:

Cheers

IGNORE THIS, I have been chasing a ghost, I created a new project and placed my CheckBox component on one of its forms and it worked fine no issues.

I have no explanation why this happened.
theLizard
BCBJ Master
BCBJ Master
 
Posts: 447
Joined: Wed Mar 18, 2009 2:14 pm

Re: Berlin

Postby theLizard » Fri Jul 08, 2016 7:18 pm

theLizard wrote:I have no explanation why this happened.


Found the cause, to do with Runtime Packages being set to false.

So now the question is how to compile to a single exe without needing to distribute my package?
theLizard
BCBJ Master
BCBJ Master
 
Posts: 447
Joined: Wed Mar 18, 2009 2:14 pm


Return to Technical

Who is online

Users browsing this forum: Bing [Bot] and 4 guests

cron