[Plugin] PawnScraper
#16

Quote:
Originally Posted by IllidanS4
View Post
I am not sure using a destructor is safe in this case. First, you ignore the size parameter, so arrays of these objects will not be destroyed properly. Second, imagine this code:
pawn Code:
new Response:globalResp;

main()
{
    new Response:resp = HttpGet("https://wiki.sa-mp.com");
    if(...)
    {
        globalResp = resp;
    }
}
When resp goes out of scope, globalResp will become invalid as well (and could potentially refer to a completely different response after a while, depending on your implementation).
Yes you are right that will result in fault. I think I should change my approach then.Something like borrow check or overload = operator to make a clone. I don't know whether either of is possible though
Reply


Messages In This Thread
PawnScraper - by SyS - 12.11.2018, 16:44
Re: PawnScraper - by Gabriel432135 - 12.11.2018, 16:59
Re: PawnScraper - by kristo - 12.11.2018, 17:12
Re: PawnScraper - by Ermanhaut - 12.11.2018, 19:44
Re: PawnScraper - by Chaprnks - 15.11.2018, 20:38
Re: PawnScraper - by SyS - 24.11.2018, 12:39
Re: PawnScraper - by Infin1ty - 24.11.2018, 17:13
Re: PawnScraper - by AmirSavand - 26.11.2018, 12:14
Re: PawnScraper - by SyS - 26.11.2018, 12:18
Re: PawnScraper - by fiki574 - 26.11.2018, 13:52
Re: PawnScraper - by IllidanS4 - 27.11.2018, 09:57
Re: PawnScraper - by SyS - 27.11.2018, 10:36
Re: PawnScraper - by fiki574 - 27.11.2018, 12:15
Re: PawnScraper - by SyS - 27.11.2018, 12:18
Re: PawnScraper - by IllidanS4 - 27.11.2018, 13:13
Re: PawnScraper - by SyS - 27.11.2018, 13:17
Re: PawnScraper - by fiki574 - 27.11.2018, 14:07
Re: PawnScraper - by fordawinzz - 01.12.2018, 12:17
Re: PawnScraper - by SyS - 01.12.2018, 12:27
Re: PawnScraper - by Marshall32 - 01.12.2018, 13:02
Re: PawnScraper - by SyS - 09.12.2018, 06:29
Re: PawnScraper - by SyS - 16.12.2018, 02:50
Re: PawnScraper - by ipsLuan - 16.12.2018, 05:08
Re: PawnScraper - by SyS - 13.01.2019, 05:31

Forum Jump:


Users browsing this thread: 3 Guest(s)