popover: Make some public API NULL-safe

Instad of potentially dereferencing a NULL-pointer, use the NULL-safe
gtk_popover_get_instance_private before the g_return_if_fail
precondition check.
This commit is contained in:
Timm Bäder 2016-08-09 19:29:41 +02:00
parent 57ef631216
commit 0d17421ffd

View File

@ -2188,7 +2188,7 @@ gboolean
gtk_popover_get_pointing_to (GtkPopover *popover, gtk_popover_get_pointing_to (GtkPopover *popover,
GdkRectangle *rect) GdkRectangle *rect)
{ {
GtkPopoverPrivate *priv = popover->priv; GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
g_return_val_if_fail (GTK_IS_POPOVER (popover), FALSE); g_return_val_if_fail (GTK_IS_POPOVER (popover), FALSE);
@ -2263,7 +2263,7 @@ void
gtk_popover_set_modal (GtkPopover *popover, gtk_popover_set_modal (GtkPopover *popover,
gboolean modal) gboolean modal)
{ {
GtkPopoverPrivate *priv = popover->priv; GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
g_return_if_fail (GTK_IS_POPOVER (popover)); g_return_if_fail (GTK_IS_POPOVER (popover));
@ -2312,7 +2312,7 @@ void
gtk_popover_set_transitions_enabled (GtkPopover *popover, gtk_popover_set_transitions_enabled (GtkPopover *popover,
gboolean transitions_enabled) gboolean transitions_enabled)
{ {
GtkPopoverPrivate *priv = popover->priv; GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
g_return_if_fail (GTK_IS_POPOVER (popover)); g_return_if_fail (GTK_IS_POPOVER (popover));
@ -2478,7 +2478,7 @@ void
gtk_popover_set_default_widget (GtkPopover *popover, gtk_popover_set_default_widget (GtkPopover *popover,
GtkWidget *widget) GtkWidget *widget)
{ {
GtkPopoverPrivate *priv = popover->priv; GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
g_return_if_fail (GTK_IS_POPOVER (popover)); g_return_if_fail (GTK_IS_POPOVER (popover));
g_return_if_fail (widget == NULL || gtk_widget_get_can_default (widget)); g_return_if_fail (widget == NULL || gtk_widget_get_can_default (widget));
@ -2513,7 +2513,7 @@ gtk_popover_set_default_widget (GtkPopover *popover,
GtkWidget * GtkWidget *
gtk_popover_get_default_widget (GtkPopover *popover) gtk_popover_get_default_widget (GtkPopover *popover)
{ {
GtkPopoverPrivate *priv = popover->priv; GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
g_return_val_if_fail (GTK_IS_POPOVER (popover), NULL); g_return_val_if_fail (GTK_IS_POPOVER (popover), NULL);
@ -2536,7 +2536,7 @@ void
gtk_popover_set_constrain_to (GtkPopover *popover, gtk_popover_set_constrain_to (GtkPopover *popover,
GtkPopoverConstraint constraint) GtkPopoverConstraint constraint)
{ {
GtkPopoverPrivate *priv = popover->priv; GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
g_return_if_fail (GTK_IS_POPOVER (popover)); g_return_if_fail (GTK_IS_POPOVER (popover));
@ -2563,7 +2563,7 @@ gtk_popover_set_constrain_to (GtkPopover *popover,
GtkPopoverConstraint GtkPopoverConstraint
gtk_popover_get_constrain_to (GtkPopover *popover) gtk_popover_get_constrain_to (GtkPopover *popover)
{ {
GtkPopoverPrivate *priv = popover->priv; GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
g_return_val_if_fail (GTK_IS_POPOVER (popover), GTK_POPOVER_CONSTRAINT_WINDOW); g_return_val_if_fail (GTK_IS_POPOVER (popover), GTK_POPOVER_CONSTRAINT_WINDOW);