forked from mirrors/gecko-dev
Bug 1870540: Fix nsPrintSettingsGTK assignment operator to null-check a member before increasing its reference count. r=stransky
This change shouldn't change behavior for most users, since g_object_ref(nullptr) fails gracefully. But in certain configurations, e.g. with environmental variable G_DEBUG=fatal-criticals, its graceful-failure will also trigger a diagnostic warning or abort, which is worth avoiding. Hence, this patch. Differential Revision: https://phabricator.services.mozilla.com/D196690
This commit is contained in:
parent
2204ff8785
commit
23fdc24deb
1 changed files with 5 additions and 1 deletions
|
|
@ -96,7 +96,11 @@ nsPrintSettingsGTK& nsPrintSettingsGTK::operator=(
|
||||||
mPrintSettings = gtk_print_settings_copy(rhs.mPrintSettings);
|
mPrintSettings = gtk_print_settings_copy(rhs.mPrintSettings);
|
||||||
|
|
||||||
if (mGTKPrinter) g_object_unref(mGTKPrinter);
|
if (mGTKPrinter) g_object_unref(mGTKPrinter);
|
||||||
mGTKPrinter = (GtkPrinter*)g_object_ref(rhs.mGTKPrinter);
|
|
||||||
|
if (rhs.mGTKPrinter) {
|
||||||
|
g_object_ref(rhs.mGTKPrinter);
|
||||||
|
}
|
||||||
|
mGTKPrinter = rhs.mGTKPrinter;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue