Error allocating Device Context

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Error allocating Device Context

Julian-2
Hello, fellow smalltalkers.

I have an odd one here....

In my application, I have a window, in which there is a drawable pane.
When this window opens, the pane grabs a bitmap image from the
drive, and displays it.
Generally, this works fine.  When I say 'generally', I have 181 offices using
my application, and this has cropped up maybe 5 or 6 times ever.
But for those offices, they get this error all the time, once it starts happening.

In my code, the #expose:clientData:callData: callback, calls my #refresh method.
This method sends #copyArea:gc:srcX:srcY:width:height:destX:destY:, which in turn
tries to prepare the drawable, part of which requires sending #getDC to the gc.
It is in this method, #getDC, that the error occurs.
In my case, the gc is an instance of CgPixmap, and in the first line of the method
is "hDC:= server deviceContext createCompatibleDC.".
This is returning NULL.

Has anyone seen a situation in which the call to createCompatibleDC has answered NULL?

My first thought, since this was working all along, but suddenly stops working for a user
(and of course, they are certain there have been no changes to their computer),
that this is some sort of hardware failure...perhaps in the graphics card.
But we all know how much users enjoy hearing that a program error is actually
related to a hardware issue.....

Is there any chance this is something that I can address in software?
Or is it really a hardware issue?
I am attaching a snippet from the walkback log below.

Any thoughts would be greatly appreciated!

Thanks, in advance, for any and all replies....

Best Regards,
Julian Ford


From the walkback log:
CgPixmap(Object)>>#error:
  receiver = a CgPixmap
  arg1 = 'Unable to allocate device context.'
CgPixmap(CgDrawable)>>#errorBadDC
  receiver = a CgPixmap
CgPixmap>>#getDC
  receiver = a CgPixmap
  temp1 = OSHdc {0}
CgGC>>#getDC
  receiver = a CgGC
CgGC>>#changeDrawable:
  receiver = a CgGC
  arg1 = a CgPixmap
CgGC>>#prepareForDrawable:
  receiver = a CgGC
  arg1 = a CgPixmap
CgPixmap(CgDrawable)>>#copyArea:gc:srcX:srcY:width:height:destX:destY:
  receiver = a CgPixmap
  arg1 = a CgPixmap
  arg2 = a CgGC
  arg3 = 0
  arg4 = 0
  arg5 = 76
  arg6 = 75
  arg7 = 0
  arg8 = 0
DbsUserDrawableAreaWidget>>#refresh
  receiver = a DbsUserDrawableAreaWidget
DbsUserDrawableAreaWidget(DbsDrawableAreaWidget)>>#expose:clientData:callData:

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Error allocating Device Context

Julian-2
I have some more info to add to my own post.
I didn't look far enough down in the walkback....

The expose callback occurs because #wmPaint:with:
calls #exposeOSRect:, passing the damaged rectangle.
When I try this, I see that the rectangle is something like
0,0 corner 132, 51.  I understand the idea of a damaged
rectangle, but I do not actually see how this is calcualted.
I gradually expose more and more of the drawing pane,
but the numbers jump around a bit.

In any case, from the walkback, the damaged rectangle
has VERY peculiar attrributes....

[] in OSComposite>>#wmPaint:with:
  receiver = OSComposite()
  blockarg1 = *OSRect {
left: -2048
top: 49227
right: 0
bottom: 1952916560
}

I can certainly see why such a rectangle might lead to a failed attempt to
allocate a DC.

So, now the questions becomes.....
how does such a rectangle get decided (seems to be an OS thing),
and/or is there some way to handle bad rectangles?
Can one corner of a damaged rectangle actually be negative?
If not, I can likely just insert a boundary check in my expose handler.
But what are reasonable boundaries?

Thanks again for any thoughts.....

Regards,
Julian

On Thursday, 7 April 2016 11:00:29 UTC-4, Julian wrote:
Hello, fellow smalltalkers.

I have an odd one here....

In my application, I have a window, in which there is a drawable pane.
When this window opens, the pane grabs a bitmap image from the
drive, and displays it.
Generally, this works fine.  When I say 'generally', I have 181 offices using
my application, and this has cropped up maybe 5 or 6 times ever.
But for those offices, they get this error all the time, once it starts happening.

In my code, the #expose:clientData:callData: callback, calls my #refresh method.
This method sends #copyArea:gc:srcX:srcY:width:height:destX:destY:, which in turn
tries to prepare the drawable, part of which requires sending #getDC to the gc.
It is in this method, #getDC, that the error occurs.
In my case, the gc is an instance of CgPixmap, and in the first line of the method
is "hDC:= server deviceContext createCompatibleDC.".
This is returning NULL.

Has anyone seen a situation in which the call to createCompatibleDC has answered NULL?

My first thought, since this was working all along, but suddenly stops working for a user
(and of course, they are certain there have been no changes to their computer),
that this is some sort of hardware failure...perhaps in the graphics card.
But we all know how much users enjoy hearing that a program error is actually
related to a hardware issue.....

Is there any chance this is something that I can address in software?
Or is it really a hardware issue?
I am attaching a snippet from the walkback log below.

Any thoughts would be greatly appreciated!

Thanks, in advance, for any and all replies....

Best Regards,
Julian Ford


From the walkback log:
CgPixmap(Object)>>#error:
  receiver = a CgPixmap
  arg1 = 'Unable to allocate device context.'
CgPixmap(CgDrawable)>>#errorBadDC
  receiver = a CgPixmap
CgPixmap>>#getDC
  receiver = a CgPixmap
  temp1 = OSHdc {0}
CgGC>>#getDC
  receiver = a CgGC
CgGC>>#changeDrawable:
  receiver = a CgGC
  arg1 = a CgPixmap
CgGC>>#prepareForDrawable:
  receiver = a CgGC
  arg1 = a CgPixmap
CgPixmap(CgDrawable)>>#copyArea:gc:srcX:srcY:width:height:destX:destY:
  receiver = a CgPixmap
  arg1 = a CgPixmap
  arg2 = a CgGC
  arg3 = 0
  arg4 = 0
  arg5 = 76
  arg6 = 75
  arg7 = 0
  arg8 = 0
DbsUserDrawableAreaWidget>>#refresh
  receiver = a DbsUserDrawableAreaWidget
DbsUserDrawableAreaWidget(DbsDrawableAreaWidget)>>#expose:clientData:callData:

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Error allocating Device Context

Instantiations mailing list
In reply to this post by Julian-2
Hi Julian,

one thing I could think of is that zour application is running out of device contexts.
As far as I remember there is just a limited abount available and if your application / Windows does not free them properly you might endup with a NULL DC...

check for loops also...

Sebastian


Am 07.04.2016 um 08:00 schrieb Julian:
Hello, fellow smalltalkers.

I have an odd one here....

In my application, I have a window, in which there is a drawable pane.
When this window opens, the pane grabs a bitmap image from the
drive, and displays it.
Generally, this works fine.  When I say 'generally', I have 181 offices using
my application, and this has cropped up maybe 5 or 6 times ever.
But for those offices, they get this error all the time, once it starts happening.

In my code, the #expose:clientData:callData: callback, calls my #refresh method.
This method sends #copyArea:gc:srcX:srcY:width:height:destX:destY:, which in turn
tries to prepare the drawable, part of which requires sending #getDC to the gc.
It is in this method, #getDC, that the error occurs.
In my case, the gc is an instance of CgPixmap, and in the first line of the method
is "hDC:= server deviceContext createCompatibleDC.".
This is returning NULL.

Has anyone seen a situation in which the call to createCompatibleDC has answered NULL?

My first thought, since this was working all along, but suddenly stops working for a user
(and of course, they are certain there have been no changes to their computer),
that this is some sort of hardware failure...perhaps in the graphics card.
But we all know how much users enjoy hearing that a program error is actually
related to a hardware issue.....

Is there any chance this is something that I can address in software?
Or is it really a hardware issue?
I am attaching a snippet from the walkback log below.

Any thoughts would be greatly appreciated!

Thanks, in advance, for any and all replies....

Best Regards,
Julian Ford


From the walkback log:
CgPixmap(Object)>>#error:
  receiver = a CgPixmap
  arg1 = 'Unable to allocate device context.'
CgPixmap(CgDrawable)>>#errorBadDC
  receiver = a CgPixmap
CgPixmap>>#getDC
  receiver = a CgPixmap
  temp1 = OSHdc {0}
CgGC>>#getDC
  receiver = a CgGC
CgGC>>#changeDrawable:
  receiver = a CgGC
  arg1 = a CgPixmap
CgGC>>#prepareForDrawable:
  receiver = a CgGC
  arg1 = a CgPixmap
CgPixmap(CgDrawable)>>#copyArea:gc:srcX:srcY:width:height:destX:destY:
  receiver = a CgPixmap
  arg1 = a CgPixmap
  arg2 = a CgGC
  arg3 = 0
  arg4 = 0
  arg5 = 76
  arg6 = 75
  arg7 = 0
  arg8 = 0
DbsUserDrawableAreaWidget>>#refresh
  receiver = a DbsUserDrawableAreaWidget
DbsUserDrawableAreaWidget(DbsDrawableAreaWidget)>>#expose:clientData:callData:
--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Error allocating Device Context

Julian-2
Hi, Sebastian!!

Yes, I had thought of that right off.  But the couple of offices experiencing this, say that rebooting the computer
does not help.  I would have thought the DCs would become available again after rebooting.

Julian

On Thursday, 7 April 2016 14:13:26 UTC-4, Sebastian Heidbrink wrote:
Hi Julian,

one thing I could think of is that zour application is running out of device contexts.
As far as I remember there is just a limited abount available and if your application / Windows does not free them properly you might endup with a NULL DC...

check for loops also...

Sebastian


Am 07.04.2016 um 08:00 schrieb Julian:
Hello, fellow smalltalkers.

I have an odd one here....

In my application, I have a window, in which there is a drawable pane.
When this window opens, the pane grabs a bitmap image from the
drive, and displays it.
Generally, this works fine.  When I say 'generally', I have 181 offices using
my application, and this has cropped up maybe 5 or 6 times ever.
But for those offices, they get this error all the time, once it starts happening.

In my code, the #expose:clientData:callData: callback, calls my #refresh method.
This method sends #copyArea:gc:srcX:srcY:width:height:destX:destY:, which in turn
tries to prepare the drawable, part of which requires sending #getDC to the gc.
It is in this method, #getDC, that the error occurs.
In my case, the gc is an instance of CgPixmap, and in the first line of the method
is "hDC:= server deviceContext createCompatibleDC.".
This is returning NULL.

Has anyone seen a situation in which the call to createCompatibleDC has answered NULL?

My first thought, since this was working all along, but suddenly stops working for a user
(and of course, they are certain there have been no changes to their computer),
that this is some sort of hardware failure...perhaps in the graphics card.
But we all know how much users enjoy hearing that a program error is actually
related to a hardware issue.....

Is there any chance this is something that I can address in software?
Or is it really a hardware issue?
I am attaching a snippet from the walkback log below.

Any thoughts would be greatly appreciated!

Thanks, in advance, for any and all replies....

Best Regards,
Julian Ford


From the walkback log:
CgPixmap(Object)>>#error:
  receiver = a CgPixmap
  arg1 = 'Unable to allocate device context.'
CgPixmap(CgDrawable)>>#errorBadDC
  receiver = a CgPixmap
CgPixmap>>#getDC
  receiver = a CgPixmap
  temp1 = OSHdc {0}
CgGC>>#getDC
  receiver = a CgGC
CgGC>>#changeDrawable:
  receiver = a CgGC
  arg1 = a CgPixmap
CgGC>>#prepareForDrawable:
  receiver = a CgGC
  arg1 = a CgPixmap
CgPixmap(CgDrawable)>>#copyArea:gc:srcX:srcY:width:height:destX:destY:
  receiver = a CgPixmap
  arg1 = a CgPixmap
  arg2 = a CgGC
  arg3 = 0
  arg4 = 0
  arg5 = 76
  arg6 = 75
  arg7 = 0
  arg8 = 0
DbsUserDrawableAreaWidget>>#refresh
  receiver = a DbsUserDrawableAreaWidget
DbsUserDrawableAreaWidget(DbsDrawableAreaWidget)>>#expose:clientData:callData:
--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="hORX5D2yBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">va-smalltalk...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="hORX5D2yBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">va-sma...@....
Visit this group at <a href="https://groups.google.com/group/va-smalltalk" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;">https://groups.google.com/group/va-smalltalk.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Error allocating Device Context

Instantiations mailing list
Just an idea, but could this be related to either resolution changes, or using the application with displays extended to other screens?  

Mike

On Thursday, April 7, 2016 at 4:53:07 PM UTC-4, Julian wrote:
Hi, Sebastian!!

Yes, I had thought of that right off.  But the couple of offices experiencing this, say that rebooting the computer
does not help.  I would have thought the DCs would become available again after rebooting.

Julian

On Thursday, 7 April 2016 14:13:26 UTC-4, Sebastian Heidbrink wrote:
Hi Julian,

one thing I could think of is that zour application is running out of device contexts.
As far as I remember there is just a limited abount available and if your application / Windows does not free them properly you might endup with a NULL DC...

check for loops also...

Sebastian


Am 07.04.2016 um 08:00 schrieb Julian:
Hello, fellow smalltalkers.

I have an odd one here....

In my application, I have a window, in which there is a drawable pane.
When this window opens, the pane grabs a bitmap image from the
drive, and displays it.
Generally, this works fine.  When I say 'generally', I have 181 offices using
my application, and this has cropped up maybe 5 or 6 times ever.
But for those offices, they get this error all the time, once it starts happening.

In my code, the #expose:clientData:callData: callback, calls my #refresh method.
This method sends #copyArea:gc:srcX:srcY:width:height:destX:destY:, which in turn
tries to prepare the drawable, part of which requires sending #getDC to the gc.
It is in this method, #getDC, that the error occurs.
In my case, the gc is an instance of CgPixmap, and in the first line of the method
is "hDC:= server deviceContext createCompatibleDC.".
This is returning NULL.

Has anyone seen a situation in which the call to createCompatibleDC has answered NULL?

My first thought, since this was working all along, but suddenly stops working for a user
(and of course, they are certain there have been no changes to their computer),
that this is some sort of hardware failure...perhaps in the graphics card.
But we all know how much users enjoy hearing that a program error is actually
related to a hardware issue.....

Is there any chance this is something that I can address in software?
Or is it really a hardware issue?
I am attaching a snippet from the walkback log below.

Any thoughts would be greatly appreciated!

Thanks, in advance, for any and all replies....

Best Regards,
Julian Ford


From the walkback log:
CgPixmap(Object)>>#error:
  receiver = a CgPixmap
  arg1 = 'Unable to allocate device context.'
CgPixmap(CgDrawable)>>#errorBadDC
  receiver = a CgPixmap
CgPixmap>>#getDC
  receiver = a CgPixmap
  temp1 = OSHdc {0}
CgGC>>#getDC
  receiver = a CgGC
CgGC>>#changeDrawable:
  receiver = a CgGC
  arg1 = a CgPixmap
CgGC>>#prepareForDrawable:
  receiver = a CgGC
  arg1 = a CgPixmap
CgPixmap(CgDrawable)>>#copyArea:gc:srcX:srcY:width:height:destX:destY:
  receiver = a CgPixmap
  arg1 = a CgPixmap
  arg2 = a CgGC
  arg3 = 0
  arg4 = 0
  arg5 = 76
  arg6 = 75
  arg7 = 0
  arg8 = 0
DbsUserDrawableAreaWidget>>#refresh
  receiver = a DbsUserDrawableAreaWidget
DbsUserDrawableAreaWidget(DbsDrawableAreaWidget)>>#expose:clientData:callData:
--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to va-smalltalk...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/va-smalltalk" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;">https://groups.google.com/group/va-smalltalk.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.