Fix a crash if GetPrinterCapsAndDefaults returns after the calling printer is deleted.
There was a crash when disconnecting from a machine via Windows RDP.  RDP injects client machine printers into the host machine.  GetPrinterCapsAndDefaults blocks on these printers.  When the user disconnects, the printer is deleted and then GetPrinterCapsAndDefaults returns.  The failure handler fires and attempts to access the now-freed PrinterJobHandler that was passed with the callback resulting in a crash.

The solution is to pass a WeakPtr to the callback so that if the PrinterJobHandler is destroyed the
callback wont fire.

BUG=122996
TEST=Verify bug.


Review URL: http://codereview.chromium.org/10079017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132283 0039d316-1c4b-4281-b951-d872f2087c98
2 files changed