Ask a Question related to Mac Programming, Design and Development.
-
Keith Wiley #1
DrawString suddenly started crashing
My programs have suddenly stopped working. I have determined that the
cause is DrawString(Str255&). Does this function no longer work with 10.2
or perhaps with CodeWarrior 8.3? Any help appreciated. I have to figure
out what the heck is going on here.
Thanks.
__________________________________________________ ______________________
Keith Wiley [email]kwiley@cs.unm.edu[/email]
[url]http://www.unm.edu/~keithw[/url] [url]http://www.mp3.com/KeithWiley[/url]
"Yet mark his perfect self-contentment, and hence learn his lesson,
that to be self-contented is to be vile and ignorant, and that to
aspire is better than to be blindly and impotently happy."
-- Edwin A. Abbott, Flatland
__________________________________________________ ______________________
Keith Wiley Guest
-
CFMX7 Started Crashing (Signal 11)
Several months ago, CFMX started crashing just after we upgraded from 4 to 7 gigabytes of RAM. I posted in these forums and got lots of great... -
CFMX server suddenly started going down
I am running CFMX 7 standard Ed in a RedHat ES 3. Things were going great but now the server goes down pretty often and I have to restart CFMX and... -
Suddenly, no memmory
Since installing a new version of OS X, FreeHand 10 has suddenly started claiming it "Could not draw the document because there is not enough... -
Photoshop 7 suddenly keeps crashing on startup
hi! i use Windows 2000 and Photoshop worked all the time perfect. I did not change any configuration or similar. Today I wanted to start Photoshop... -
Camino 0.7.0 suddenly crashing on startup
This morning I came in and was unable to launch Camino 0.7.0. The crashlog says that it was checking the version of a runtime library. I have... -
David Phillip Oster #2
Re: DrawString suddenly started crashing
In article <Pine.LNX.4.56.0309022312310.8552@santafe.cs.unm.e du>,
Keith Wiley <kwiley@cs.unm.edu> wrote:
DrawString is fine in OS X 10.2, CW 8.3. The problem is your program.> My programs have suddenly stopped working. I have determined that the
> cause is DrawString(Str255&). Does this function no longer work with 10.2
> or perhaps with CodeWarrior 8.3? Any help appreciated. I have to figure
> out what the heck is going on here.
At the point that DrawString crashs, is the heap OK? is the current
GrafPort OK?
David Phillip Oster Guest
-
Keith Wiley #3
Re: DrawString suddenly started crashing
On Wed, 3 Sep 2003, David Phillip Oster wrote:
Impossible. I wrote a toy program to test DrawString and it doesn't even> In article <Pine.LNX.4.56.0309022312310.8552@santafe.cs.unm.e du>,
> Keith Wiley <kwiley@cs.unm.edu> wrote:
>>> > My programs have suddenly stopped working. I have determined that the
> > cause is DrawString(Str255&). Does this function no longer work with 10.2
> > or perhaps with CodeWarrior 8.3? Any help appreciated. I have to figure
> > out what the heck is going on here.
> DrawString is fine in OS X 10.2, CW 8.3. The problem is your program.
> At the point that DrawString crashs, is the heap OK? is the current
> GrafPort OK?
work. The following "program" crashes at the DrawString line:
#include <Carbon.h>
#include <time.h>
int main()
{
WindowPtr w = GetNewCWindow(128, NULL, NULL);
SetPort((OpaqueGrafPtr*)w);
MoveTo (10,10);
DrawString("\pHello");
long st = TickCount();
while (TickCount() - st < 60 * 5);
return 0;
}
__________________________________________________ ______________________
Keith Wiley [email]kwiley@cs.unm.edu[/email]
[url]http://www.unm.edu/~keithw[/url] [url]http://www.mp3.com/KeithWiley[/url]
"Yet mark his perfect self-contentment, and hence learn his lesson,
that to be self-contented is to be vile and ignorant, and that to
aspire is better than to be blindly and impotently happy."
-- Edwin A. Abbott, Flatland
__________________________________________________ ______________________
Keith Wiley Guest
-
Tom Dowdy #4
Re: DrawString suddenly started crashing
In article <Pine.LNX.4.56.0309030831340.10701@santafe.cs.unm. edu>,
Keith Wiley <kwiley@cs.unm.edu> wrote:
"Impossible." Perhaps that word doesn't mean what you think it does? :-)>> > DrawString is fine in OS X 10.2, CW 8.3. The problem is your program.
> > At the point that DrawString crashs, is the heap OK? is the current
> > GrafPort OK?
> Impossible. I wrote a toy program to test DrawString and it doesn't even
> work. The following "program" crashes at the DrawString line:
>
> #include <Carbon.h>
> #include <time.h>
>
> int main()
> {
> WindowPtr w = GetNewCWindow(128, NULL, NULL);
>
> SetPort((OpaqueGrafPtr*)w);
Casting Windows (and other things) is illegal on OS X and has been since
day 1. Call the appropriate Get function (ie, GetWindowPort) or the
appropriate helper function instead (ie, SetPortWindowPort). So:
SetPortWindowPort(w);
-OR-
SetPort(GetWindowPort(w));
You might want to do wholescale searches in your source code for:
"GrafPtr)"
"WindowPtr)"
"DialogPtr)"
"GWorldPtr)"
to avoid similar crashes in the future.
Tom Dowdy Guest
-
David Phillip Oster #5
Re: DrawString suddenly started crashing
In article <dowdy-9848B2.08303803092003@news.apple.com>,
Tom Dowdy <dowdy@apple.com> wrote:
Keith also forgot to initialize the toolbox by calling InitCursor();> In article <Pine.LNX.4.56.0309030831340.10701@santafe.cs.unm. edu>,
> Keith Wiley <kwiley@cs.unm.edu> wrote:
>>> >> > > DrawString is fine in OS X 10.2, CW 8.3. The problem is your program.
> > > At the point that DrawString crashs, is the heap OK? is the current
> > > GrafPort OK?
> > Impossible. I wrote a toy program to test DrawString and it doesn't even
> > work. The following "program" crashes at the DrawString line:
> >
> > #include <Carbon.h>
> > #include <time.h>
> >
> > int main()
> > {
> > WindowPtr w = GetNewCWindow(128, NULL, NULL);
> >
> > SetPort((OpaqueGrafPtr*)w);
> "Impossible." Perhaps that word doesn't mean what you think it does? :-)
>
> Casting Windows (and other things) is illegal on OS X and has been since
> day 1. Call the appropriate Get function (ie, GetWindowPort) or the
> appropriate helper function instead (ie, SetPortWindowPort). So:
> SetPortWindowPort(w);
> -OR-
> SetPort(GetWindowPort(w));
>
> You might want to do wholescale searches in your source code for:
> "GrafPtr)"
> "WindowPtr)"
> "DialogPtr)"
> "GWorldPtr)"
> to avoid similar crashes in the future.
That omission alone would cause his program to crash.
TickCount() returns an unsigned long, so while() loop also, won't do
what he expects if his machine has been on for a few weeks.
also, If this is C++, C-style casts are deprecated in C++.
David Phillip Oster Guest
-
Keith Wiley #6
Re: DrawString suddenly started crashing
On Wed, 3 Sep 2003, John Harrison wrote:
Well, aside from you sarcasm, did you bother to notice my five line> I love the attitude.
>
> 'I've got a problem, I've no idea what's causing it, I need help, but I know
> that it CANNOT POSSIBLY be my fault.'.
example. Are you suggesting that program is so complicated that I've lost
a pointer somewhere?
__________________________________________________ ______________________
Keith Wiley [email]kwiley@cs.unm.edu[/email]
[url]http://www.unm.edu/~keithw[/url] [url]http://www.mp3.com/KeithWiley[/url]
"Yet mark his perfect self-contentment, and hence learn his lesson,
that to be self-contented is to be vile and ignorant, and that to
aspire is better than to be blindly and impotently happy."
-- Edwin A. Abbott, Flatland
__________________________________________________ ______________________
Keith Wiley Guest
-
Keith Wiley #7
Re: DrawString suddenly started crashing
On Wed, 3 Sep 2003, Tom Dowdy wrote:
That did it. Thanks. To the folks who thought it would be more helpful> Casting Windows (and other things) is illegal on OS X and has been since
> day 1. Call the appropriate Get function (ie, GetWindowPort) or the
> appropriate helper function instead (ie, SetPortWindowPort). So:
> SetPortWindowPort(w);
to insult me, thanks for nothing. What a wonderful help you were. To
this guy and the guy who suggested InitCursor, thanks tremendously for the
help.
Cheers!
__________________________________________________ ______________________
Keith Wiley [email]kwiley@cs.unm.edu[/email]
[url]http://www.unm.edu/~keithw[/url] [url]http://www.mp3.com/KeithWiley[/url]
"Yet mark his perfect self-contentment, and hence learn his lesson,
that to be self-contented is to be vile and ignorant, and that to
aspire is better than to be blindly and impotently happy."
-- Edwin A. Abbott, Flatland
__________________________________________________ ______________________
Keith Wiley Guest
-
John Harrison #8
Re: DrawString suddenly started crashing
"Keith Wiley" <kwiley@cs.unm.edu> wrote in message
news:Pine.LNX.4.56.0309031139450.11988@santafe.cs. unm.edu...know> On Wed, 3 Sep 2003, John Harrison wrote:
>> > I love the attitude.
> >
> > 'I've got a problem, I've no idea what's causing it, I need help, but II know very little about Mac programming and I wouldn't be able to offer>> > that it CANNOT POSSIBLY be my fault.'.
> Well, aside from you sarcasm, did you bother to notice my five line
> example. Are you suggesting that program is so complicated that I've lost
> a pointer somewhere?
>
advice on your code.
Your second post made me smile, that's all, sorry to offend.
john
John Harrison Guest
-
Miro Jurisic #9
Re: DrawString suddenly started crashing
In article <oster-ACFC40.10070103092003@news.sf.sbcglobal.net>,
David Phillip Oster <oster@ieee.org> wrote:
On Carbon?> Keith also forgot to initialize the toolbox by calling InitCursor();
> That omission alone would cause his program to crash.
meeroh
--
If this message helped you, consider buying an item
from my wish list: <http://web.meeroh.org/wishlist>
Miro Jurisic Guest
-
Michael Ash #10
Re: DrawString suddenly started crashing
In article <Pine.LNX.4.56.0309031145350.11988@santafe.cs.unm. edu>,
Keith Wiley <kwiley@cs.unm.edu> wrote:
You get better help if you lose the whole "it's not my fault, it's> To the folks who thought it would be more helpful
> to insult me, thanks for nothing.
impossible, it's obviously the OS that has the problem" attitude.
Michael Ash Guest
-
David Phillip Oster #11
Re: DrawString suddenly started crashing
In article <macdev-293122.19233503092003@senator-bedfellow.mit.edu>,
Miro Jurisic <macdev@meeroh.org> wrote:
I was probably over-generalizing from technote 2003, which implies that> In article <oster-ACFC40.10070103092003@news.sf.sbcglobal.net>,
> David Phillip Oster <oster@ieee.org> wrote:
>>> > Keith also forgot to initialize the toolbox by calling InitCursor();
> > That omission alone would cause his program to crash.
> On Carbon?
it is necessary. <http://developer.apple.com/technotes/tn/pdf/tn2003.pdf>
and
<[url]http://developer.apple.com/documentation/Carbon/Reference/Carbon_Spec_Po[/url]
rting/QuickDraw_Manager.html>
"When your Carbon application is launched, the system sets the cursor to
the watch cursor. Your application should call InitCursor at the end of
its startup initialization process, to reset the cursor. Available in
CarbonLib 1.0 and later when running Mac OS 8.1 or later. Available in
Mac OS X 10.0 and later."
David Phillip Oster Guest
-
Eric Albert #12
Re: DrawString suddenly started crashing
In article <oster-DCA70D.22032703092003@news.sf.sbcglobal.net>,
David Phillip Oster <oster@ieee.org> wrote:
The implication is wrong. InitCursor() is not necessary in Carbon on> In article <macdev-293122.19233503092003@senator-bedfellow.mit.edu>,
> Miro Jurisic <macdev@meeroh.org> wrote:
>>> > In article <oster-ACFC40.10070103092003@news.sf.sbcglobal.net>,
> > David Phillip Oster <oster@ieee.org> wrote:
> >> >> > > Keith also forgot to initialize the toolbox by calling InitCursor();
> > > That omission alone would cause his program to crash.
> > On Carbon?
> I was probably over-generalizing from technote 2003, which implies that
> it is necessary. <http://developer.apple.com/technotes/tn/pdf/tn2003.pdf>
> and
> <[url]http://developer.apple.com/documentation/Carbon/Reference/Carbon_Spec_Po[/url]
> rting/QuickDraw_Manager.html>
>
> "When your Carbon application is launched, the system sets the cursor to
> the watch cursor. Your application should call InitCursor at the end of
> its startup initialization process, to reset the cursor. Available in
> CarbonLib 1.0 and later when running Mac OS 8.1 or later. Available in
> Mac OS X 10.0 and later."
Mac OS X. Nor, for that matter, will the system set the cursor to the
watch cursor when a Carbon application is launched on Mac OS X.
-Eric
--
Eric Albert [email]ejalbert@stanford.edu[/email]
[url]http://rescomp.stanford.edu/~ejalbert/[/url]
Eric Albert Guest



Reply With Quote

