Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: ACE reporter crash



Permlink Replies: 9 - Last Post: May 16, 2016 10:24 AM Last Post By: Steve Tyrakowski
Milan Bačík

Posts: 10
Registered: 2/4/11
ACE reporter crash
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 11, 2016 3:07 AM
We have a problem with ACE reporter(2.07) in Builder 2010. It crash when under some specific conditions. You have to have printer behind print server, which is becoming more and more common these days. Know you have to use remote desktop and share this printer. And last requirement is that you have to set this printer as default on target computer. Ace reporter crash even when diferent printer is set for print(Printer->PrinterIndex). Other applications can use this printer without problems and ace also work with other network printers shared through remote desktop. Any idea if there is anything to do to fix or workaround this problem ?
Steve Tyrakowski

Posts: 19
Registered: 5/7/97
Re: ACE reporter crash
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 11, 2016 8:34 AM   in response to: Milan Bačík in response to: Milan Bačík
In article <851976 at forums dot embarcadero dot com>, Milan Bačík wrote:
We have a problem with ACE reporter(2.07) in Builder 2010. It crash
when under some specific conditions. You have to have printer behind
print server, which is becoming more and more common these days. Know
you have to use remote desktop and share this printer. And last requirement
is that you have to set this printer as default on target computer.
Ace reporter crash even when diferent printer is set for print(Printer->PrinterIndex).
Other applications can use this printer without problems and ace also
wo
rk with other network printers shared through remote desktop. Any
idea if there is anything to do to fix or workaround this problem
?

I've had a couple reports like this over the years but have not been able to reproduce
the problem. I think it is somehow related to a call we make to get the printer's
capabilities, but without a reproducible case I can't trace where it is happening.

I'm not clear on the environment you are describing that causes the problem. It sounds
like you are using Windows Remote Desktop to access the computer that is actually
running the report, but you are trying to redirect it to a printer on your local
computer?

Steve Tyrakowski
SCT Associates, Inc.
Milan Bačík

Posts: 10
Registered: 2/4/11
Re: ACE reporter crash
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 12, 2016 5:30 AM   in response to: Steve Tyrakowski in response to: Steve Tyrakowski
I've had a couple reports like this over the years but have not been able to reproduce
the problem.
We had problems with reproducing too. Most network printers works fine. Only print server, that redirect print to various printers(using your ID card at one of those printers leads to print on that printer) fails. If tehere is anything from printer properties you need to know i can copy it.

I think it is somehow related to a call we make to get the printer's capabilities, but without a reproducible case I can't trace where it is happening.
Actual line that crash is:
Report->PageSetup->Anyprinters

Well most suprising is, that this printer is not used for actual print, it is only default printer in windows. It seems like ACE read printers capabilities of default printer regardles of actual printer(Printer->PrinterIndex).


I'm not clear on the environment you are describing that causes the problem. It sounds
like you are using Windows Remote Desktop to access the computer that is actually
running the report, but you are trying to redirect it to a printer on your local
computer?

Yes. And when i run my aplication directly on local computer having same printer set as default it don't fail.

Edited by: Milan Bačík on May 12, 2016 5:35 AM
Steve Tyrakowski

Posts: 19
Registered: 5/7/97
Re: ACE reporter crash [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 12, 2016 6:54 AM   in response to: Milan Bačík in response to: Milan Bačík
In article <852164 at forums dot embarcadero dot com>, Milan Bačík wrote:
Actual line that crash is:
Report->PageSetup->Anyprinters

Ultimately that calls this function in ACESETUP.PAS. For testing, try
to comment out everything in that function except the 1st result line.

Function TAcePrinterSetup.GetPrinterCount: Integer;
//var
// DefaultPrinter: array[0..79] of Char;
begin
result := Printers.Printer.Printers.Count;
{ under win95 there was some unknown printer always coming
up when there really was none. I made the asumption that
if there isn't a default printer then there are no printers
defined. This wasn't tested under NT or win3.1 so I don't
know if it was needed under that. }
// GetProfileString('windows', 'device', '', DefaultPrinter,
// SizeOf(DefaultPrinter) - 1);
// if DefaultPrinter[0] = #0 then result := 0;
end;


I know you said you cannot reliably reproduce the problem, but does it
reliably reproduce on your client's computer so you can see if this
makes a difference?

Steve T.
Steve Tyrakowski

Posts: 19
Registered: 5/7/97
Re: ACE reporter crash [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 12, 2016 12:14 PM   in response to: Steve Tyrakowski in response to: Steve Tyrakowski
In article <852170 at forums dot embarcadero dot com>, Steve Tyrakowski wrote:
Ultimately that calls this function in ACESETUP.PAS. For testing, try
to comment out everything in that function except the 1st result line.

Function TAcePrinterSetup.GetPrinterCount: Integer;
//var
// DefaultPrinter: array[0..79] of Char;
begin
result := Printers.Printer.Printers.Count;
{ under win95 there was some unknown printer always coming
up when there really was none. I made the asumption that
if there isn't a default printer then there are no printers
defined. This wasn't tested under NT or win3.1 so I don't
know if it was needed under that. }
// GetProfileString('windows', 'device', '', DefaultPrinter,
// SizeOf(DefaultPrinter) - 1);
// if DefaultPrinter[0] = #0 then result := 0;
end;
-----------------------------------------------------------------

That caused a problem on a Win10 VM that had 4 printers but no default
specified, so that's a no-go.

Forcing result to 0 did not seem to have any initial problems in very
brief testing. From what I see in the code, this printer count is never
used for anything besides seeing if it is > 0. When I forced it to zero
I was still able to select any of the printers in the print setup dialog.

Note that in C++ if you change that Delphi unit, you will need to be sure
to not use the runtime package for ACE in your project (CBuilder defaults
to using the runtime packages).

Please let me know if this solves your crashing. I will try using that
change for my client apps to see if it causes any problems forcing it to
zero and will consider it for the next update to ACE if it solves your
issue and shows no other problems.

Steve T
Milan Bačík

Posts: 10
Registered: 2/4/11
Re: ACE reporter crash [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 16, 2016 5:39 AM   in response to: Steve Tyrakowski in response to: Steve Tyrakowski
Steve Tyrakowski wrote:
In article <852170 at forums dot embarcadero dot com>, Steve Tyrakowski wrote:
Ultimately that calls this function in ACESETUP.PAS. For testing, try
to comment out everything in that function except the 1st result line.

Function TAcePrinterSetup.GetPrinterCount: Integer;
//var
// DefaultPrinter: array[0..79] of Char;
begin
result := Printers.Printer.Printers.Count;
{ under win95 there was some unknown printer always coming
up when there really was none. I made the asumption that
if there isn't a default printer then there are no printers
defined. This wasn't tested under NT or win3.1 so I don't
know if it was needed under that. }
// GetProfileString('windows', 'device', '', DefaultPrinter,
// SizeOf(DefaultPrinter) - 1);
// if DefaultPrinter[0] = #0 then result := 0;
end;
-----------------------------------------------------------------

You can easily reproduce this problem by renaming printer to name which is more than 80 chars in length and set it as default printer. Problem is probably that SizeOf(DefaultPrinter) is 160 and not 80.

Edited by: Milan Bačík on May 16, 2016 6:29 AM
Steve Tyrakowski

Posts: 19
Registered: 5/7/97
Re: ACE reporter crash [Edit] [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 16, 2016 10:24 AM   in response to: Milan Bačík in response to: Milan Bačík
In article <853273 at forums dot embarcadero dot com>, Milan Bačík wrote:
You can easily reproduce this problem by renaming printer to name which is more than 80
chars in length and set it as default printer. Problem is probably that
SizeOf(DefaultPrinter) is 160 and not 80.

OK I reproduced the AV. I'll probably increase the buffer size in the next release, but the
problem with the crash should be fixed if you change the call to:

GetProfileString('windows', 'device', '', DefaultPrinter,
(SizeOf(DefaultPrinter) div SizeOf(Char)) - 1);

That looks like a Unicode thing I missed that only affected if printer name was > 80 chars
for the default printer.

Let me know if that solves your problem.

Steve T.
Milan Bačík

Posts: 10
Registered: 2/4/11
Re: ACE reporter crash [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 13, 2016 2:31 AM   in response to: Steve Tyrakowski in response to: Steve Tyrakowski
Steve Tyrakowski wrote:
In article <852164 at forums dot embarcadero dot com>, Milan Bačík wrote:
Actual line that crash is:
Report->PageSetup->Anyprinters

Ultimately that calls this function in ACESETUP.PAS. For testing, try
to comment out everything in that function except the 1st result line.

Function TAcePrinterSetup.GetPrinterCount: Integer;
//var
// DefaultPrinter: array[0..79] of Char;
begin
result := Printers.Printer.Printers.Count;
{ under win95 there was some unknown printer always coming
up when there really was none. I made the asumption that
if there isn't a default printer then there are no printers
defined. This wasn't tested under NT or win3.1 so I don't
know if it was needed under that. }
// GetProfileString('windows', 'device', '', DefaultPrinter,
// SizeOf(DefaultPrinter) - 1);
// if DefaultPrinter[0] = #0 then result := 0;
end;


I know you said you cannot reliably reproduce the problem, but does it
reliably reproduce on your client's computer so you can see if this
makes a difference?

Steve T.

I can reliably reproduce problem since I reprodece it. I tryed to call GetPrinterCount directly and it fail. After comenting GetPrinterCount as you sugested it works fine and AnyPrinters works fine too.

We have another problem that is not directly conected to this printer configuration. When we upgrade from 2.02 to 2.07 version we have problem with TAcePreview. It is blank and after forcing repaint by resizing or scroling it paints OK. When we reverted to 2.02 it works fine again. I cant test other versions as i dont have them.

And yet one question. One of non reproducable problems is in case when no preview is used, and report is printed in backround. In our code we destruct DataSet used in report after Run() finished. It looks like those data are used after Run as we get AV in DB library.

Edited by: Milan Bačík on May 13, 2016 5:58 AM
Steve Tyrakowski

Posts: 19
Registered: 5/7/97
Re: ACE reporter crash [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 13, 2016 7:54 AM   in response to: Milan Bačík in response to: Milan Bačík
In article <852712 at forums dot embarcadero dot com>, Milan Bačík wrote:
I have one problem which is maybe my fail. When I try to acces GetPrinterCount
by this code it fails:
Rep->PageSetup->GetAcePrinterSetup(AcePrinterSetup); //here Assign fails
int iPrintCount = AcePrinterSetup->PrinterCount;
When i changed FAcePrinterSetup to public and call :
int iPrintCount = Rep->PageSetup->FAcePrinterSetup->PrinterCount;

Did you create the AcePrinterSetup object before calling that method to assign
it?

FAcePrinterSetup is private because it is not supposed to be accessed outside of
the object.

Hopefully all that code was just for trying to test the problem. If you need to
get the printer count, I would suggest it is easier to just use the VCL global
TPrinter object:

Printer->Printers->count

Second problem is not directly conected to this printer configuration.
When we upgrade from 2.02 to 2.07 version we have problem with TAcePreview.
It is blank and after forcing repaint by resizing or scroling it paints
OK. When we reverted to 2.02 it works fine again. I cant test other
versions as i dont have them.

Please email me a bare minimum sample that reproduces this. Just combine the
PAS and DFM files into a ZIP and send to my email and we can continue this in
email.

With Delphi 10 Seattle and ACE 2.08 on Windows 10 I made a simple form with a
button and a TAcePreview and the click of the button calls LoadFromFile method
of the AcePreview and the previewer was not blank.

Steve Tyrakowski
Steve Tyrakowski

Posts: 19
Registered: 5/7/97
Re: ACE reporter crash [Edit] [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 13, 2016 8:04 AM   in response to: Milan Bačík in response to: Milan Bačík
In article <852871 at forums dot embarcadero dot com>, Milan Bačík wrote:
And yet one question. One of non reproducable problems is in case
when no preview is used, and report is printed in backround. In our
code we destruct DataSet used in report after Run() finished. It looks
like those data are used after Run as we get AV in DB library.

What do you mean by printing in the background? When Run() is finished
it is no longer running any ACE code.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02