Strange problem when porting from gecko 1.8 to 1.9 - Mozilla

This is a discussion on Strange problem when porting from gecko 1.8 to 1.9 - Mozilla ; Hello, all. I am porting a xpcom component from FF2 to FF3. I am catching a strange problem, something that should not happen, specially because it worked well on the former gecko version The problem is that I am calling ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Strange problem when porting from gecko 1.8 to 1.9

  1. Strange problem when porting from gecko 1.8 to 1.9



    Hello, all.

    I am porting a xpcom component from FF2 to FF3.

    I am catching a strange problem, something that should not happen, specially because it worked well on the former gecko version


    The problem is that I am calling the nsICategoryManager::AddCategoryEntry(..., &previous) method, and then it returns something on the last parameter ( previous),

    As I don't need it I was freeing the buffers of memory right away by calling nsMemory::Free(previous).

    Strange as may seem this function crashes... And I have no Idea why... It was working on gecko 1.8.

    Shouldn't I use this Free() method to free the memory allocated by AddCategoryEntry() ? Should I use somethin else?

    Has anybody had this problem already? If so , how did you fix it?

    Thanks in advance for your help

    Best,
    Oliveiros

    NB : previous is declared as
    char * previous = nsnull;

  2. Re: Strange problem when porting from gecko 1.8 to 1.9

    Hi.

    Are you doing something like this? I use this peace of code in my XPCom
    component, no problems with gecko 1.9.
    But I have others problems related with javascript, please see this message
    "Firefox 3 stops loading pages with javascript" on this forum. Maybe you can
    help me.

    I hope this peace of code works for you.

    (...)
    nsCOMPtr compMan;
    nsresult rv = NS_GetComponentManager(getter_AddRefs(compMan));
    if (NS_FAILED(rv))
    {
    return rv;
    }

    nsCOMPtr servman = nsnull;
    rv = compMan->QueryInterface(NS_GET_IID(nsIServiceManager),
    getter_AddRefs(servman));
    if (NS_FAILED(rv))
    {
    return rv;
    }

    nsCOMPtr catman;
    rv = servman->GetServiceByContractID(NS_CATEGORYMANAGER_CONTRACT ID,
    NS_GET_IID(nsICategoryManager),
    getter_AddRefs(catman));
    if (NS_FAILED(rv))
    {
    return rv;
    }

    char* previous = NULL;

    rv = catman->AddCategoryEntry("xpcom-startup",
    "MySetup",
    SETUP_CONTRACTID,
    TRUE,
    TRUE,
    &previous);

    if (previous)
    {
    PR_Free(previous);
    }
    (...)

    "Oliveiros Cristina" escreveu na mensagem
    news:mailman.2026.1221155544.3597.dev-extensions@lists.mozilla.org...


    Hello, all.

    I am porting a xpcom component from FF2 to FF3.

    I am catching a strange problem, something that should not happen, specially
    because it worked well on the former gecko version


    The problem is that I am calling the
    nsICategoryManager::AddCategoryEntry(..., &previous) method, and then it
    returns something on the last parameter ( previous),

    As I don't need it I was freeing the buffers of memory right away by calling
    nsMemory::Free(previous).

    Strange as may seem this function crashes... And I have no Idea why... It
    was working on gecko 1.8.

    Shouldn't I use this Free() method to free the memory allocated by
    AddCategoryEntry() ? Should I use somethin else?

    Has anybody had this problem already? If so , how did you fix it?

    Thanks in advance for your help

    Best,
    Oliveiros

    NB : previous is declared as
    char * previous = nsnull;



  3. Re: Strange problem when porting from gecko 1.8 to 1.9

    Hi!

    This is pretty much the same code I use, except for the PR_Free() function
    which is new for me.
    My problem arises precisely there, the code before works without any
    problem.

    Gonna try this and check out your previous message, if I've already had the
    problem you reported,
    I'll get back to you to tell you how I solved it

    Best,
    Oliveiros


    ----- Original Message -----
    From: "Rafael Franco"
    Newsgroups: mozilla.dev.extensions
    To:
    Sent: Friday, September 12, 2008 3:26 PM
    Subject: Re: Strange problem when porting from gecko 1.8 to 1.9


    > Hi.
    >
    > Are you doing something like this? I use this peace of code in my XPCom
    > component, no problems with gecko 1.9.
    > But I have others problems related with javascript, please see this
    > message "Firefox 3 stops loading pages with javascript" on this forum.
    > Maybe you can help me.
    >
    > I hope this peace of code works for you.
    >
    > (...)
    > nsCOMPtr compMan;
    > nsresult rv = NS_GetComponentManager(getter_AddRefs(compMan));
    > if (NS_FAILED(rv))
    > {
    > return rv;
    > }
    >
    > nsCOMPtr servman = nsnull;
    > rv = compMan->QueryInterface(NS_GET_IID(nsIServiceManager),
    > getter_AddRefs(servman));
    > if (NS_FAILED(rv))
    > {
    > return rv;
    > }
    >
    > nsCOMPtr catman;
    > rv = servman->GetServiceByContractID(NS_CATEGORYMANAGER_CONTRACT ID,
    > NS_GET_IID(nsICategoryManager),
    > getter_AddRefs(catman));
    > if (NS_FAILED(rv))
    > {
    > return rv;
    > }
    >
    > char* previous = NULL;
    >
    > rv = catman->AddCategoryEntry("xpcom-startup",
    > "MySetup",
    > SETUP_CONTRACTID,
    > TRUE,
    > TRUE,
    > &previous);
    >
    > if (previous)
    > {
    > PR_Free(previous);
    > }
    > (...)
    >
    > "Oliveiros Cristina" escreveu na mensagem
    > news:mailman.2026.1221155544.3597.dev-extensions@lists.mozilla.org...
    >
    >
    > Hello, all.
    >
    > I am porting a xpcom component from FF2 to FF3.
    >
    > I am catching a strange problem, something that should not happen,
    > specially because it worked well on the former gecko version
    >
    >
    > The problem is that I am calling the
    > nsICategoryManager::AddCategoryEntry(..., &previous) method, and then it
    > returns something on the last parameter ( previous),
    >
    > As I don't need it I was freeing the buffers of memory right away by
    > calling nsMemory::Free(previous).
    >
    > Strange as may seem this function crashes... And I have no Idea why...
    > It was working on gecko 1.8.
    >
    > Shouldn't I use this Free() method to free the memory allocated by
    > AddCategoryEntry() ? Should I use somethin else?
    >
    > Has anybody had this problem already? If so , how did you fix it?
    >
    > Thanks in advance for your help
    >
    > Best,
    > Oliveiros
    >
    > NB : previous is declared as
    > char * previous = nsnull;
    >
    > _______________________________________________
    > dev-extensions mailing list
    > dev-extensions@lists.mozilla.org
    > https://lists.mozilla.org/listinfo/dev-extensions



+ Reply to Thread