Last Comment Bug 16763 - CreateInstance implementation does not check for aggregation
: CreateInstance implementation does not check for aggregation
Status: RESOLVED INCOMPLETE
:
Product: Core
Classification: Components
Component: XPCOM (show other bugs)
: Trunk
: All All
: P3 normal (vote)
: Future
Assigned To: Nobody; OK to take it and work on it
:
: Nathan Froyd [:froydnj]
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 1999-10-19 02:05 PDT by Heikki Toivonen (remove -bugzilla when emailing directly)
Modified: 2009-07-24 11:45 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Possible occurrences of this bug (10.45 KB, text/html)
1999-11-04 23:55 PST, Heikki Toivonen (remove -bugzilla when emailing directly)
no flags Details

Description Heikki Toivonen (remove -bugzilla when emailing directly) 1999-10-19 02:05:42 PDT
Many implementations of CreateInstance do not check the value of the [in]
parameter (typically 'aOuter') that tells if aggregation is to be used. Most
implementations are not aggregations so they should check it and report
NS_ERROR_NO_AGGREGATION if appropriate.
Comment 1 Suresh Duddi (gone) 1999-10-19 13:46:59 PDT
Yeah I have seen some of this too.
Comment 2 Heikki Toivonen (remove -bugzilla when emailing directly) 1999-11-04 23:53:59 PST
I must be really bored... I decided to flex my Perl muscle(s?) a bit to find
where this bug occurs. But not so bored that I would have made the script
perfect. I guess jst & julle @citec.fi are as bored as I am and we spent a
considerable amount of time figuring out how to run this script, heh.

Finally when all else was set and I started it on NT with the bash shell it went
fine for some time and then got access violation. So I asked jst to run the same
thing on Linux so eventually we got some output ;)

Anyway, the script is below and I will attach the script output.

--ht.pl--
#!perl
#
# Utitility to find CreateInstance implementations that do not
# return NS_ERROR_NO_AGGREGATION. See Bugzilla bug #16763.
#
# Invocation (from MOZ_TOP directory) (bash):
#   for i in `find . -name '*.h' -or -name '*.cpp'`; do ht.pl $i; done
#

$file = $ARGV[0];
$in = 0;
$line = 0;
$brace = 0;
$in_method = 0;
$create_line = "";

# If true, output is in HTML (need html, head, body tags)
$html = 1;
# LXR base
$lxr = "http://lxr.mozilla.org/seamonkey/source/";

if ($html) {
  print "<ul>\n";
}

while (<>) {
  $line++;

  if (/Factory::CreateInstance/) {
    if ($html) {
      $create_line = "<li><a href=\"$lxr$file#$line\">$file:$line:</a> $_</li>";
    } else {
      $create_line = "$file:$line: $_";
    }
    $in = 1;
  }

  if ($in) {
    if (/\{/) {
      if ($brace++ == 0) {
        $in_method = 1;
      }
    }
    if (/\}/) {
      $brace--;
    }

    if ($brace < 0) {
      if ($html) {
        print "</ul><p><b>Misplaced braces?</b></p>\n";
      } else {
        print "Misplaced braces?\n";
      }
      exit;
    }

    if ($in_method and $brace == 0) {
      $in = 0;
      $in_method = 0;
      print "$create_line";
    }

    if ($in_method and /NS_ERROR_NO_AGGREGATION/) {
      $brace = 0;
      $in = 0;
      $in_method = 0;
    }
  }
}

if ($html) {
  print "</ul>\n";
}
Comment 3 Heikki Toivonen (remove -bugzilla when emailing directly) 1999-11-04 23:55:59 PST
Created attachment 2662 [details]
Possible occurrences of this bug
Comment 4 Scott Collins 2000-03-30 10:35:32 PST
Note: this is another good thing to check for with the [XP]COM lint script.
Comment 5 Scott Collins 2000-05-15 01:38:27 PDT
mass re-assigning to my new bugzilla account
Comment 6 Dawn Endico 2000-12-21 14:10:27 PST
dp is no longer @netscape.com. changing qa contact to default for this product
Comment 7 Scott Collins 2002-11-03 13:16:07 PST
re-assigning to XPCOM owner

Note You need to log in before you can comment on or make changes to this bug.