1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

Remove (unused) widget ref counting.

This commit is contained in:
Dave Davenport 2018-06-12 10:08:29 +02:00
parent d4cfb5bb4b
commit 0633bc9dad
3 changed files with 6 additions and 27 deletions

View file

@ -94,9 +94,6 @@ struct _widget
/** Name of widget (used for theming) */ /** Name of widget (used for theming) */
char *name; char *name;
const char *state; const char *state;
/** Used for reference counting */
int ref_count;
}; };
/** /**

View file

@ -323,11 +323,5 @@ int widget_get_absolute_xpos ( widget *wid );
*/ */
int widget_get_absolute_ypos ( widget *wid ); int widget_get_absolute_ypos ( widget *wid );
/**
* @param wid The widget handle
*
* Increment the reference count on the widget.
*/
void widget_ref ( widget *wid );
/*@}*/ /*@}*/
#endif // ROFI_WIDGET_H #endif // ROFI_WIDGET_H

View file

@ -27,7 +27,6 @@
#include <glib.h> #include <glib.h>
#include <math.h> #include <math.h>
#include <stdatomic.h>
#include "widgets/widget.h" #include "widgets/widget.h"
#include "widgets/widget-internal.h" #include "widgets/widget-internal.h"
#include "theme.h" #include "theme.h"
@ -37,8 +36,6 @@
void widget_init ( widget *wid, widget *parent, WidgetType type, const char *name ) void widget_init ( widget *wid, widget *parent, WidgetType type, const char *name )
{ {
wid->ref_count = 1;
wid->type = type; wid->type = type;
wid->parent = parent; wid->parent = parent;
wid->name = g_strdup ( name ); wid->name = g_strdup ( name );
@ -363,18 +360,10 @@ void widget_draw ( widget *widget, cairo_t *d )
} }
} }
void widget_ref ( widget *wid )
{
g_assert ( wid != NULL );
g_assert ( wid->ref_count > 0 );
atomic_fetch_add( &(wid->ref_count), 1);
}
void widget_free ( widget *wid ) void widget_free ( widget *wid )
{ {
if ( wid ) { if ( wid ) {
if ( atomic_fetch_sub ( &(wid->ref_count), 1) == 1 ) {
if ( wid->name ) { if ( wid->name ) {
g_free ( wid->name ); g_free ( wid->name );
} }
@ -383,7 +372,6 @@ void widget_free ( widget *wid )
} }
return; return;
} }
}
} }
int widget_get_height ( widget *widget ) int widget_get_height ( widget *widget )