Merge ~kondor-dani/compiz:dbus-bool-fix into compiz:master

Proposed by Daniel Kondor
Status: Superseded
Proposed branch: ~kondor-dani/compiz:dbus-bool-fix
Merge into: compiz:master
Prerequisite: ~kondor-dani/compiz:dbus-fix
Diff against target: 93 lines (+11/-13)
2 files modified
plugins/dbus/src/dbus.cpp (+11/-11)
src/screen.cpp (+0/-2)
Reviewer Review Type Date Requested Status
Compiz Maintainers Pending
Review via email: mp+384374@code.launchpad.net

This proposal has been superseded by a proposal from 2020-05-21.

Commit message

Proposed fix for #1641944

Description of the change

Needs to use dbus_bool_t instead of bool.

To post a comment you must log in.
Revision history for this message
Dmitry Shachnev (mitya57) :
Revision history for this message
Alberts Muktupāvels (muktupavels) :

Unmerged commits

1617e17... by Daniel Kondor

dbus: need to use dbus_bool_t instead of bool

Passing the address of a bool variable to a C function is undefined behavior.
Notably, the dbus library expects a dbus_bool_t, which is an alias for uint32_t,
but checks that the value is either zero or one. On the other hand, the C++
compiler is free to use a smaller size object to represent a bool and also
free to use any value for true.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/plugins/dbus/src/dbus.cpp b/plugins/dbus/src/dbus.cpp
2index fd322b2..2246e5e 100644
3--- a/plugins/dbus/src/dbus.cpp
4+++ b/plugins/dbus/src/dbus.cpp
5@@ -495,7 +495,7 @@ DbusScreen::handleActionMessage (DBusConnection *connection,
6 switch (dbus_message_iter_get_arg_type (&iter)) {
7 case DBUS_TYPE_BOOLEAN:
8 {
9- bool tmp;
10+ dbus_bool_t tmp;
11 type = CompOption::TypeBool;
12 dbus_message_iter_get_basic (&iter, &tmp);
13 value.set (tmp ? true : false);
14@@ -602,7 +602,7 @@ DbusScreen::getOptionValue (DBusMessageIter *iter,
15 switch (type) {
16 case CompOption::TypeBool:
17 {
18- bool b;
19+ dbus_bool_t b;
20 success = tryGetValueWithType (iter, DBUS_TYPE_BOOLEAN, &b);
21 if (success)
22 value.set (b ? true : false);
23@@ -682,7 +682,7 @@ DbusScreen::getOptionValue (DBusMessageIter *iter,
24 break;
25 case CompOption::TypeBell:
26 {
27- bool bell;
28+ dbus_bool_t bell;
29 CompAction action;
30
31 success = tryGetValueWithType (iter, DBUS_TYPE_BOOLEAN, &bell);
32@@ -818,7 +818,7 @@ DbusScreen::appendSimpleOptionValue (DBusMessage *message,
33 switch (type) {
34 case CompOption::TypeBool:
35 {
36- bool b = value.b () ? true : false;
37+ dbus_bool_t b = value.b () ? TRUE : FALSE;
38 dbus_message_append_args (message,
39 DBUS_TYPE_BOOLEAN, &b,
40 DBUS_TYPE_INVALID);
41@@ -887,7 +887,7 @@ DbusScreen::appendSimpleOptionValue (DBusMessage *message,
42 break;
43 case CompOption::TypeBell:
44 {
45- bool bell = value.action ().bell () ? true : false;
46+ dbus_bool_t bell = value.action ().bell () ? TRUE : FALSE;
47 dbus_message_append_args (message,
48 DBUS_TYPE_BOOLEAN, &bell,
49 DBUS_TYPE_INVALID);
50@@ -955,7 +955,7 @@ DbusScreen::appendListOptionValue (DBusMessage *message,
51 break;
52 case CompOption::TypeBool:
53 {
54- bool b = val.b () ? true : false;
55+ dbus_bool_t b = val.b () ? TRUE : FALSE;
56 dbus_message_iter_append_basic (&listIter, sig[0], &b);
57 }
58 break;
59@@ -1274,17 +1274,17 @@ DbusScreen::handleGetPluginMetadataMessage (DBusConnection *connection,
60
61 if (p)
62 {
63- bool initializedPlugin = true;
64- char *shortDesc = NULL;
65- char *longDesc = NULL;
66- const char *blankStr = "";
67+ dbus_bool_t initializedPlugin = TRUE;
68+ char *shortDesc = NULL;
69+ char *longDesc = NULL;
70+ const char *blankStr = "";
71
72 reply = dbus_message_new_method_return (message);
73
74 if (loadedPlugin)
75 {
76 if (!(*p->vTable->init) (p))
77- initializedPlugin = false;
78+ initializedPlugin = FALSE;
79 }
80
81 if (initializedPlugin && p->vTable->getMetadata)
82diff --git a/src/screen.cpp b/src/screen.cpp
83index c5e0adc..8323ec4 100644
84--- a/src/screen.cpp
85+++ b/src/screen.cpp
86@@ -366,8 +366,6 @@ cps::EventManager::removeWatchFd (CompWatchFdHandle handle)
87 return;
88 }
89
90- w->destroy();
91-
92 watchFds.erase (it);
93 }
94

Subscribers

People subscribed via source and target branches