xpcom/tests/TestCOMPtr.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include <assert.h>
michael@0 7 #include <stdio.h>
michael@0 8 #include "nsCOMPtr.h"
michael@0 9 #include "nsISupports.h"
michael@0 10
michael@0 11 #define NS_IFOO_IID \
michael@0 12 { 0x6f7652e0, 0xee43, 0x11d1, \
michael@0 13 { 0x9c, 0xc3, 0x00, 0x60, 0x08, 0x8c, 0xa6, 0xb3 } }
michael@0 14
michael@0 15 class IFoo : public nsISupports
michael@0 16 {
michael@0 17 public:
michael@0 18 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFOO_IID)
michael@0 19
michael@0 20 public:
michael@0 21 IFoo();
michael@0 22 // virtual dtor because IBar uses our Release()
michael@0 23 virtual ~IFoo();
michael@0 24
michael@0 25 NS_IMETHOD_(MozExternalRefCountType) AddRef();
michael@0 26 NS_IMETHOD_(MozExternalRefCountType) Release();
michael@0 27 NS_IMETHOD QueryInterface( const nsIID&, void** );
michael@0 28
michael@0 29 static void print_totals();
michael@0 30
michael@0 31 private:
michael@0 32 unsigned int refcount_;
michael@0 33
michael@0 34 static unsigned int total_constructions_;
michael@0 35 static unsigned int total_destructions_;
michael@0 36 };
michael@0 37
michael@0 38 NS_DEFINE_STATIC_IID_ACCESSOR(IFoo, NS_IFOO_IID)
michael@0 39
michael@0 40 class IBar;
michael@0 41
michael@0 42 // some types I'll need
michael@0 43 typedef unsigned long NS_RESULT;
michael@0 44
michael@0 45 // some functions I'll need (and define below)
michael@0 46 nsresult CreateIFoo( void** );
michael@0 47 nsresult CreateIBar( void** result );
michael@0 48 void AnIFooPtrPtrContext( IFoo** );
michael@0 49 void AnISupportsPtrPtrContext( nsISupports** );
michael@0 50 void AVoidPtrPtrContext( void** );
michael@0 51 void set_a_IFoo( nsCOMPtr<IFoo>* result );
michael@0 52 nsCOMPtr<IFoo> return_a_IFoo();
michael@0 53
michael@0 54
michael@0 55
michael@0 56
michael@0 57 unsigned int IFoo::total_constructions_;
michael@0 58 unsigned int IFoo::total_destructions_;
michael@0 59
michael@0 60 class test_message
michael@0 61 {
michael@0 62 public:
michael@0 63 test_message()
michael@0 64 {
michael@0 65 printf("BEGIN unit tests for |nsCOMPtr|, compiled " __DATE__ "\n");
michael@0 66 }
michael@0 67
michael@0 68 ~test_message()
michael@0 69 {
michael@0 70 IFoo::print_totals();
michael@0 71 printf("END unit tests for |nsCOMPtr|.\n");
michael@0 72 }
michael@0 73 };
michael@0 74
michael@0 75 test_message gTestMessage;
michael@0 76
michael@0 77
michael@0 78 /*
michael@0 79 ...
michael@0 80 */
michael@0 81
michael@0 82 void
michael@0 83 IFoo::print_totals()
michael@0 84 {
michael@0 85 printf("total constructions/destructions --> %d/%d\n",
michael@0 86 total_constructions_, total_destructions_);
michael@0 87 }
michael@0 88
michael@0 89 IFoo::IFoo()
michael@0 90 : refcount_(0)
michael@0 91 {
michael@0 92 ++total_constructions_;
michael@0 93 printf(" new IFoo@%p [#%d]\n",
michael@0 94 static_cast<void*>(this), total_constructions_);
michael@0 95 }
michael@0 96
michael@0 97 IFoo::~IFoo()
michael@0 98 {
michael@0 99 ++total_destructions_;
michael@0 100 printf("IFoo@%p::~IFoo() [#%d]\n",
michael@0 101 static_cast<void*>(this), total_destructions_);
michael@0 102 }
michael@0 103
michael@0 104 MozExternalRefCountType
michael@0 105 IFoo::AddRef()
michael@0 106 {
michael@0 107 ++refcount_;
michael@0 108 printf("IFoo@%p::AddRef(), refcount --> %d\n",
michael@0 109 static_cast<void*>(this), refcount_);
michael@0 110 return refcount_;
michael@0 111 }
michael@0 112
michael@0 113 MozExternalRefCountType
michael@0 114 IFoo::Release()
michael@0 115 {
michael@0 116 int newcount = --refcount_;
michael@0 117 if ( newcount == 0 )
michael@0 118 printf(">>");
michael@0 119
michael@0 120 printf("IFoo@%p::Release(), refcount --> %d\n",
michael@0 121 static_cast<void*>(this), refcount_);
michael@0 122
michael@0 123 if ( newcount == 0 )
michael@0 124 {
michael@0 125 printf(" delete IFoo@%p\n", static_cast<void*>(this));
michael@0 126 printf("<<IFoo@%p::Release()\n", static_cast<void*>(this));
michael@0 127 delete this;
michael@0 128 }
michael@0 129
michael@0 130 return newcount;
michael@0 131 }
michael@0 132
michael@0 133 nsresult
michael@0 134 IFoo::QueryInterface( const nsIID& aIID, void** aResult )
michael@0 135 {
michael@0 136 printf("IFoo@%p::QueryInterface()\n", static_cast<void*>(this));
michael@0 137 nsISupports* rawPtr = 0;
michael@0 138 nsresult status = NS_OK;
michael@0 139
michael@0 140 if ( aIID.Equals(NS_GET_IID(IFoo)) )
michael@0 141 rawPtr = this;
michael@0 142 else
michael@0 143 {
michael@0 144 nsID iid_of_ISupports = NS_ISUPPORTS_IID;
michael@0 145 if ( aIID.Equals(iid_of_ISupports) )
michael@0 146 rawPtr = static_cast<nsISupports*>(this);
michael@0 147 else
michael@0 148 status = NS_ERROR_NO_INTERFACE;
michael@0 149 }
michael@0 150
michael@0 151 NS_IF_ADDREF(rawPtr);
michael@0 152 *aResult = rawPtr;
michael@0 153
michael@0 154 return status;
michael@0 155 }
michael@0 156
michael@0 157 nsresult
michael@0 158 CreateIFoo( void** result )
michael@0 159 // a typical factory function (that calls AddRef)
michael@0 160 {
michael@0 161 printf(">>CreateIFoo() --> ");
michael@0 162 IFoo* foop = new IFoo;
michael@0 163 printf("IFoo@%p\n", static_cast<void*>(foop));
michael@0 164
michael@0 165 foop->AddRef();
michael@0 166 *result = foop;
michael@0 167
michael@0 168 printf("<<CreateIFoo()\n");
michael@0 169 return NS_OK;
michael@0 170 }
michael@0 171
michael@0 172 void
michael@0 173 set_a_IFoo( nsCOMPtr<IFoo>* result )
michael@0 174 {
michael@0 175 printf(">>set_a_IFoo()\n");
michael@0 176 assert(result);
michael@0 177
michael@0 178 nsCOMPtr<IFoo> foop( do_QueryInterface(new IFoo) );
michael@0 179 *result = foop;
michael@0 180 printf("<<set_a_IFoo()\n");
michael@0 181 }
michael@0 182
michael@0 183 nsCOMPtr<IFoo>
michael@0 184 return_a_IFoo()
michael@0 185 {
michael@0 186 printf(">>return_a_IFoo()\n");
michael@0 187 nsCOMPtr<IFoo> foop( do_QueryInterface(new IFoo) );
michael@0 188 printf("<<return_a_IFoo()\n");
michael@0 189 return foop;
michael@0 190 }
michael@0 191
michael@0 192
michael@0 193
michael@0 194
michael@0 195 #define NS_IBAR_IID \
michael@0 196 { 0x6f7652e1, 0xee43, 0x11d1, \
michael@0 197 { 0x9c, 0xc3, 0x00, 0x60, 0x08, 0x8c, 0xa6, 0xb3 } }
michael@0 198
michael@0 199 class IBar : public IFoo
michael@0 200 {
michael@0 201 public:
michael@0 202 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IBAR_IID)
michael@0 203
michael@0 204 public:
michael@0 205 IBar();
michael@0 206 virtual ~IBar();
michael@0 207
michael@0 208 NS_IMETHOD QueryInterface( const nsIID&, void** );
michael@0 209 };
michael@0 210
michael@0 211 NS_DEFINE_STATIC_IID_ACCESSOR(IBar, NS_IBAR_IID)
michael@0 212
michael@0 213 IBar::IBar()
michael@0 214 {
michael@0 215 printf(" new IBar@%p\n", static_cast<void*>(this));
michael@0 216 }
michael@0 217
michael@0 218 IBar::~IBar()
michael@0 219 {
michael@0 220 printf("IBar@%p::~IBar()\n", static_cast<void*>(this));
michael@0 221 }
michael@0 222
michael@0 223 nsresult
michael@0 224 IBar::QueryInterface( const nsID& aIID, void** aResult )
michael@0 225 {
michael@0 226 printf("IBar@%p::QueryInterface()\n", static_cast<void*>(this));
michael@0 227 nsISupports* rawPtr = 0;
michael@0 228 nsresult status = NS_OK;
michael@0 229
michael@0 230 if ( aIID.Equals(NS_GET_IID(IBar)) )
michael@0 231 rawPtr = this;
michael@0 232 else if ( aIID.Equals(NS_GET_IID(IFoo)) )
michael@0 233 rawPtr = static_cast<IFoo*>(this);
michael@0 234 else
michael@0 235 {
michael@0 236 nsID iid_of_ISupports = NS_ISUPPORTS_IID;
michael@0 237 if ( aIID.Equals(iid_of_ISupports) )
michael@0 238 rawPtr = static_cast<nsISupports*>(this);
michael@0 239 else
michael@0 240 status = NS_ERROR_NO_INTERFACE;
michael@0 241 }
michael@0 242
michael@0 243 NS_IF_ADDREF(rawPtr);
michael@0 244 *aResult = rawPtr;
michael@0 245
michael@0 246 return status;
michael@0 247 }
michael@0 248
michael@0 249
michael@0 250
michael@0 251 nsresult
michael@0 252 CreateIBar( void** result )
michael@0 253 // a typical factory function (that calls AddRef)
michael@0 254 {
michael@0 255 printf(">>CreateIBar() --> ");
michael@0 256 IBar* barp = new IBar;
michael@0 257 printf("IBar@%p\n", static_cast<void*>(barp));
michael@0 258
michael@0 259 barp->AddRef();
michael@0 260 *result = barp;
michael@0 261
michael@0 262 printf("<<CreateIBar()\n");
michael@0 263 return NS_OK;
michael@0 264 }
michael@0 265
michael@0 266 void
michael@0 267 AnIFooPtrPtrContext( IFoo** )
michael@0 268 {
michael@0 269 }
michael@0 270
michael@0 271 void
michael@0 272 AVoidPtrPtrContext( void** )
michael@0 273 {
michael@0 274 }
michael@0 275
michael@0 276 void
michael@0 277 AnISupportsPtrPtrContext( nsISupports** )
michael@0 278 {
michael@0 279 }
michael@0 280
michael@0 281 static
michael@0 282 nsresult
michael@0 283 TestBloat_Raw_Unsafe()
michael@0 284 {
michael@0 285 IBar* barP = 0;
michael@0 286 nsresult result = CreateIBar(reinterpret_cast<void**>(&barP));
michael@0 287
michael@0 288 if ( barP )
michael@0 289 {
michael@0 290 IFoo* fooP = 0;
michael@0 291 if ( NS_SUCCEEDED( result = barP->QueryInterface(NS_GET_IID(IFoo), reinterpret_cast<void**>(&fooP)) ) )
michael@0 292 {
michael@0 293 fooP->print_totals();
michael@0 294 NS_RELEASE(fooP);
michael@0 295 }
michael@0 296
michael@0 297 NS_RELEASE(barP);
michael@0 298 }
michael@0 299
michael@0 300 return result;
michael@0 301 }
michael@0 302
michael@0 303
michael@0 304 static
michael@0 305 nsresult
michael@0 306 TestBloat_Smart()
michael@0 307 {
michael@0 308 nsCOMPtr<IBar> barP;
michael@0 309 nsresult result = CreateIBar( getter_AddRefs(barP) );
michael@0 310
michael@0 311 nsCOMPtr<IFoo> fooP( do_QueryInterface(barP, &result) );
michael@0 312
michael@0 313 if ( fooP )
michael@0 314 fooP->print_totals();
michael@0 315
michael@0 316 return result;
michael@0 317 }
michael@0 318
michael@0 319
michael@0 320
michael@0 321
michael@0 322 nsCOMPtr<IFoo> gFoop;
michael@0 323
michael@0 324 int
michael@0 325 main()
michael@0 326 {
michael@0 327 printf(">>main()\n");
michael@0 328
michael@0 329 printf("sizeof(nsCOMPtr<IFoo>) --> %u\n", unsigned(sizeof(nsCOMPtr<IFoo>)));
michael@0 330
michael@0 331 TestBloat_Raw_Unsafe();
michael@0 332 TestBloat_Smart();
michael@0 333
michael@0 334
michael@0 335 {
michael@0 336 printf("\n### Test 1: will a |nsCOMPtr| call |AddRef| on a pointer assigned into it?\n");
michael@0 337 nsCOMPtr<IFoo> foop( do_QueryInterface(new IFoo) );
michael@0 338
michael@0 339 printf("\n### Test 2: will a |nsCOMPtr| |Release| its old pointer when a new one is assigned in?\n");
michael@0 340 foop = do_QueryInterface(new IFoo);
michael@0 341
michael@0 342 // [Shouldn't compile] Is it a compile time error to try to |AddRef| by hand?
michael@0 343 //foop->AddRef();
michael@0 344
michael@0 345 // [Shouldn't compile] Is it a compile time error to try to |Release| be hand?
michael@0 346 //foop->Release();
michael@0 347
michael@0 348 // [Shouldn't compile] Is it a compile time error to try to |delete| an |nsCOMPtr|?
michael@0 349 //delete foop;
michael@0 350
michael@0 351 printf("\n### Test 3: can you |AddRef| if you must?\n");
michael@0 352 static_cast<IFoo*>(foop)->AddRef();
michael@0 353
michael@0 354 printf("\n### Test 4: can you |Release| if you must?\n");
michael@0 355 static_cast<IFoo*>(foop)->Release();
michael@0 356
michael@0 357 printf("\n### Test 5: will a |nsCOMPtr| |Release| when it goes out of scope?\n");
michael@0 358 }
michael@0 359
michael@0 360 {
michael@0 361 printf("\n### Test 6: will a |nsCOMPtr| call the correct destructor?\n");
michael@0 362 nsCOMPtr<IFoo> foop( do_QueryInterface(new IBar) );
michael@0 363 }
michael@0 364
michael@0 365 {
michael@0 366 printf("\n### Test 7: can you compare one |nsCOMPtr| with another [!=]?\n");
michael@0 367
michael@0 368 nsCOMPtr<IFoo> foo1p( do_QueryInterface(new IFoo) );
michael@0 369
michael@0 370 // [Shouldn't compile] Is it a compile time error to omit |getter_[doesnt_]AddRef[s]|?
michael@0 371 //AnIFooPtrPtrContext(&foo1p);
michael@0 372
michael@0 373 // [Shouldn't compile] Is it a compile time error to omit |getter_[doesnt_]AddRef[s]|?
michael@0 374 //AVoidPtrPtrContext(&foo1p);
michael@0 375
michael@0 376 nsCOMPtr<IFoo> foo2p( do_QueryInterface(new IFoo) );
michael@0 377
michael@0 378 if ( foo1p != foo2p )
michael@0 379 printf("foo1p != foo2p\n");
michael@0 380 else
michael@0 381 printf("foo1p == foo2p\n");
michael@0 382
michael@0 383 printf("\n### Test 7.5: can you compare a |nsCOMPtr| with NULL, 0, nullptr [!=]?\n");
michael@0 384 if ( foo1p != 0 )
michael@0 385 printf("foo1p != 0\n");
michael@0 386 if ( 0 != foo1p )
michael@0 387 printf("0 != foo1p\n");
michael@0 388 if ( foo1p == 0 )
michael@0 389 printf("foo1p == 0\n");
michael@0 390 if ( 0 == foo1p )
michael@0 391 printf("0 == foo1p\n");
michael@0 392
michael@0 393
michael@0 394 IFoo* raw_foo2p = foo2p.get();
michael@0 395
michael@0 396 printf("\n### Test 8: can you compare a |nsCOMPtr| with a raw interface pointer [!=]?\n");
michael@0 397 if ( foo1p.get() != raw_foo2p )
michael@0 398 printf("foo1p != raw_foo2p\n");
michael@0 399 else
michael@0 400 printf("foo1p == raw_foo2p\n");
michael@0 401
michael@0 402
michael@0 403 printf("\n### Test 9: can you assign one |nsCOMPtr| into another?\n");
michael@0 404 foo1p = foo2p;
michael@0 405
michael@0 406 printf("\n### Test 10: can you compare one |nsCOMPtr| with another [==]?\n");
michael@0 407 if ( foo1p == foo2p )
michael@0 408 printf("foo1p == foo2p\n");
michael@0 409 else
michael@0 410 printf("foo1p != foo2p\n");
michael@0 411
michael@0 412 printf("\n### Test 11: can you compare a |nsCOMPtr| with a raw interface pointer [==]?\n");
michael@0 413 if ( raw_foo2p == foo2p.get() )
michael@0 414 printf("raw_foo2p == foo2p\n");
michael@0 415 else
michael@0 416 printf("raw_foo2p != foo2p\n");
michael@0 417
michael@0 418 #if 1
michael@0 419 printf("\n### Test 11.5: can you compare a |nsCOMPtr| with a raw interface pointer [==]?\n");
michael@0 420 if ( nsCOMPtr<IFoo>( raw_foo2p ) == foo2p )
michael@0 421 printf("raw_foo2p == foo2p\n");
michael@0 422 else
michael@0 423 printf("raw_foo2p != foo2p\n");
michael@0 424 #endif
michael@0 425
michael@0 426 printf("\n### Test 12: bare pointer test?\n");
michael@0 427 if ( foo1p )
michael@0 428 printf("foo1p is not NULL\n");
michael@0 429 else
michael@0 430 printf("foo1p is NULL\n");
michael@0 431
michael@0 432 printf("\n### Test 13: numeric pointer test?\n");
michael@0 433 if ( foo1p == 0 )
michael@0 434 printf("foo1p is NULL\n");
michael@0 435 else
michael@0 436 printf("foo1p is not NULL\n");
michael@0 437
michael@0 438 #if 0
michael@0 439 if ( foo1p == 1 )
michael@0 440 printf("foo1p allowed compare with in\n");
michael@0 441 #endif
michael@0 442
michael@0 443 printf("\n### Test 14: how about when two |nsCOMPtr|s referring to the same object go out of scope?\n");
michael@0 444 }
michael@0 445
michael@0 446 {
michael@0 447 printf("\n### Test 15,16 ...setup...\n");
michael@0 448 IFoo* raw_foo1p = new IFoo;
michael@0 449 raw_foo1p->AddRef();
michael@0 450
michael@0 451 IFoo* raw_foo2p = new IFoo;
michael@0 452 raw_foo2p->AddRef();
michael@0 453
michael@0 454 printf("\n### Test 15: what if I don't want to |AddRef| when I construct?\n");
michael@0 455 nsCOMPtr<IFoo> foo1p( dont_AddRef(raw_foo1p) );
michael@0 456 //nsCOMPtr<IFoo> foo1p = dont_AddRef(raw_foo1p);
michael@0 457
michael@0 458 printf("\n### Test 16: what if I don't want to |AddRef| when I assign in?\n");
michael@0 459 nsCOMPtr<IFoo> foo2p;
michael@0 460 foo2p = dont_AddRef(raw_foo2p);
michael@0 461 }
michael@0 462
michael@0 463
michael@0 464
michael@0 465
michael@0 466
michael@0 467
michael@0 468
michael@0 469 {
michael@0 470 printf("\n### setup for Test 17\n");
michael@0 471 nsCOMPtr<IFoo> foop;
michael@0 472 printf("### Test 17: basic parameter behavior?\n");
michael@0 473 CreateIFoo( nsGetterAddRefs<IFoo>(foop) );
michael@0 474 }
michael@0 475 printf("### End Test 17\n");
michael@0 476
michael@0 477
michael@0 478 {
michael@0 479 printf("\n### setup for Test 18\n");
michael@0 480 nsCOMPtr<IFoo> foop;
michael@0 481 printf("### Test 18: basic parameter behavior, using the short form?\n");
michael@0 482 CreateIFoo( getter_AddRefs(foop) );
michael@0 483 }
michael@0 484 printf("### End Test 18\n");
michael@0 485
michael@0 486
michael@0 487 {
michael@0 488 printf("\n### setup for Test 19, 20\n");
michael@0 489 nsCOMPtr<IFoo> foop;
michael@0 490 printf("### Test 19: reference parameter behavior?\n");
michael@0 491 set_a_IFoo(address_of(foop));
michael@0 492
michael@0 493 printf("### Test 20: return value behavior?\n");
michael@0 494 foop = return_a_IFoo();
michael@0 495 }
michael@0 496 printf("### End Test 19, 20\n");
michael@0 497
michael@0 498 {
michael@0 499 printf("\n### setup for Test 21\n");
michael@0 500 nsCOMPtr<IFoo> fooP;
michael@0 501
michael@0 502 printf("### Test 21: is |QueryInterface| called on assigning in a raw pointer?\n");
michael@0 503 fooP = do_QueryInterface(new IFoo);
michael@0 504 }
michael@0 505 printf("### End Test 21\n");
michael@0 506
michael@0 507 {
michael@0 508 printf("\n### setup for Test 22\n");
michael@0 509 nsCOMPtr<IFoo> fooP;
michael@0 510 fooP = do_QueryInterface(new IFoo);
michael@0 511
michael@0 512 nsCOMPtr<IFoo> foo2P;
michael@0 513
michael@0 514 printf("### Test 22: is |QueryInterface| _not_ called when assigning in a smart-pointer of the same type?\n");
michael@0 515 foo2P = fooP;
michael@0 516 }
michael@0 517 printf("### End Test 22\n");
michael@0 518
michael@0 519 {
michael@0 520 printf("\n### setup for Test 23\n");
michael@0 521 nsCOMPtr<IBar> barP( do_QueryInterface(new IBar) );
michael@0 522
michael@0 523 printf("### Test 23: is |QueryInterface| called when assigning in a smart-pointer of a different type?\n");
michael@0 524
michael@0 525 nsCOMPtr<IFoo> fooP( do_QueryInterface(barP) );
michael@0 526 if ( fooP )
michael@0 527 printf("an IBar* is an IFoo*\n");
michael@0 528 }
michael@0 529 printf("### End Test 23\n");
michael@0 530
michael@0 531
michael@0 532 {
michael@0 533 printf("\n### setup for Test 24\n");
michael@0 534 nsCOMPtr<IFoo> fooP( do_QueryInterface(new IFoo) );
michael@0 535
michael@0 536 printf("### Test 24: does |forget| avoid an AddRef/Release when assigning to another nsCOMPtr?\n");
michael@0 537 nsCOMPtr<IFoo> fooP2( fooP.forget() );
michael@0 538 }
michael@0 539 printf("### End Test 24\n");
michael@0 540
michael@0 541 {
michael@0 542 nsCOMPtr<IFoo> fooP;
michael@0 543
michael@0 544 AnIFooPtrPtrContext( getter_AddRefs(fooP) );
michael@0 545 AVoidPtrPtrContext( getter_AddRefs(fooP) );
michael@0 546 }
michael@0 547
michael@0 548
michael@0 549 {
michael@0 550 nsCOMPtr<nsISupports> supportsP;
michael@0 551
michael@0 552 AVoidPtrPtrContext( getter_AddRefs(supportsP) );
michael@0 553 AnISupportsPtrPtrContext( getter_AddRefs(supportsP) );
michael@0 554 }
michael@0 555
michael@0 556
michael@0 557 printf("\n### Test 25: will a static |nsCOMPtr| |Release| before program termination?\n");
michael@0 558 gFoop = do_QueryInterface(new IFoo);
michael@0 559
michael@0 560 printf("<<main()\n");
michael@0 561 return 0;
michael@0 562 }
michael@0 563

mercurial