login about faq

When doing the following:

ckCert * pCert = CkCertStore_FindCertBySubject(certStore,"Chilkat Software, Inc.");

success = CkSocket_InitSslServer(listenSslSocket,pCert);

Is it necessary to "dispose" pCert when done with it? Or does the CkSocket now own it and will dispose pCert for me?

Do ChilKat objects have reference counts with AddRef/Release like methods?

Signed 'Dazed and Confused'

asked Apr 09 '13 at 17:57

JSU153's gravatar image

JSU153
1111


The code snippet you provided above is incorrect. In the Chilkat "C" API, C++ objects (such as "CkCert") are not used. The "C" function you mentioned actually looks like this:

HCkCert CkCertStore_FindCertBySubject(HCkCertStore cHandle, const char *subject)

The "C" language does not use object. Therefore, the object-oriented API uses handles to opaque objects. Any handle returned from a Chilkat "C" function, such as an HCkCert, must be disposed by using the corresponding dispose function for that object. For example:

HCkCert hCert = CkCertStore_FindCertBySubject(certStore,"Chilkat Software, Inc.");
...
CkCert_Dispose(hCert);

link

answered Apr 09 '13 at 18:24

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

The code snippet I provided comes from the sample code

http://www.example-code.com/vcpp/ssl_server.asp

The sample code does not dispose the cert object.

link

answered Apr 09 '13 at 18:32

JSU153's gravatar image

JSU153
1111

Thanks! I updated the example.

(Apr 10 '13 at 08:57) chilkat ♦♦

I see that you added "delete cert" in the example. I expected "cert->dispose()" to be the school solution (per your documentation). Since the dispose method is opaque, can you confirm that it also deletes the cert object?

(Apr 10 '13 at 09:46) JSU153

The example is C++. In C++, the Chilkat objects returned by a Chilkat method must be deleted.

This is different than in the Chilkat "C" API. In the "C" API, you must call the "dispose" method, such as CkCert_Dispose(hCert), passing it the handle.

(Apr 10 '13 at 10:03) chilkat ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×9
×4
×3
×2
×1

Asked: Apr 09 '13 at 17:57

Seen: 833 times

Last updated: Apr 10 '13 at 10:03

powered by OSQA