summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2018-06-12 10:08:29 +0200
committerDave Davenport <qball@gmpclient.org>2018-06-12 10:08:29 +0200
commit0633bc9dad5cccc7c5a851649aff23fce0caa9b7 (patch)
tree1ee542b8792531bc41c97d1d86c55a2feb8b7f6b
parentd4cfb5bb4ba94199871475c3faea015670a53fda (diff)
Remove (unused) widget ref counting.
-rw-r--r--include/widgets/widget-internal.h3
-rw-r--r--include/widgets/widget.h6
-rw-r--r--source/widgets/widget.c24
3 files changed, 6 insertions, 27 deletions
diff --git a/include/widgets/widget-internal.h b/include/widgets/widget-internal.h
index 762f5723..e32c8766 100644
--- a/include/widgets/widget-internal.h
+++ b/include/widgets/widget-internal.h
@@ -94,9 +94,6 @@ struct _widget
/** Name of widget (used for theming) */
char *name;
const char *state;
-
- /** Used for reference counting */
- int ref_count;
};
/**
diff --git a/include/widgets/widget.h b/include/widgets/widget.h
index 28fd94c3..f2f8d6ca 100644
--- a/include/widgets/widget.h
+++ b/include/widgets/widget.h
@@ -323,11 +323,5 @@ int widget_get_absolute_xpos ( 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
diff --git a/source/widgets/widget.c b/source/widgets/widget.c
index 22869959..0e512905 100644
--- a/source/widgets/widget.c
+++ b/source/widgets/widget.c
@@ -27,7 +27,6 @@
#include <glib.h>
#include <math.h>
-#include <stdatomic.h>
#include "widgets/widget.h"
#include "widgets/widget-internal.h"
#include "theme.h"
@@ -37,8 +36,6 @@
void widget_init ( widget *wid, widget *parent, WidgetType type, const char *name )
{
- wid->ref_count = 1;
-
wid->type = type;
wid->parent = parent;
wid->name = g_strdup ( name );
@@ -363,26 +360,17 @@ 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 )
{
if ( wid ) {
- if ( atomic_fetch_sub ( &(wid->ref_count), 1) == 1 ) {
- if ( wid->name ) {
- g_free ( wid->name );
- }
- if ( wid->free ) {
- wid->free ( wid );
- }
- return;
+ if ( wid->name ) {
+ g_free ( wid->name );
}
+ if ( wid->free ) {
+ wid->free ( wid );
+ }
+ return;
}
}