Don't try to carry over qPrintable() pointers
authorLasse Holmstedt <lasse.holmstedt@nokia.com>
Thu, 2 Feb 2012 14:54:05 +0000 (15:54 +0100)
committerGunnar Sletta <gunnar.sletta@nokia.com>
Fri, 3 Feb 2012 08:36:20 +0000 (09:36 +0100)
The pointer is out of scope by the time it's sent through wayland.

Change-Id: I00e9f050dfa47bf078921600d2bf63502f0b4897
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Ian Monroe <ian.monroe@nokia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
src/compositor/wayland_wrapper/wlextendedsurface.cpp
src/compositor/wayland_wrapper/wlextendedsurface.h
src/compositor/wayland_wrapper/wlsurface.cpp

index 5ee1f93..38e4dff 100644 (file)
@@ -94,7 +94,7 @@ ExtendedSurface::~ExtendedSurface()
 
 }
 
-void ExtendedSurface::sendGenericProperty(const char *name, const QVariant &variant)
+void ExtendedSurface::sendGenericProperty(const QString &name, const QVariant &variant)
 {
     QByteArray byteValue;
     QDataStream ds(&byteValue, QIODevice::WriteOnly);
@@ -103,7 +103,7 @@ void ExtendedSurface::sendGenericProperty(const char *name, const QVariant &vari
     data.size = byteValue.size();
     data.data = (void*) byteValue.constData();
     data.alloc = 0;
-    wl_resource_post_event(m_extended_surface_resource,WL_EXTENDED_SURFACE_SET_GENERIC_PROPERTY, name,&data);
+    wl_resource_post_event(m_extended_surface_resource,WL_EXTENDED_SURFACE_SET_GENERIC_PROPERTY, qPrintable(name), &data);
 
 }
 
index 2bc1f63..5cbabe6 100644 (file)
@@ -78,7 +78,7 @@ public:
     ExtendedSurface(struct wl_client *client, uint32_t id, Surface *surface);
     ~ExtendedSurface();
 
-    void sendGenericProperty(const char *name, const QVariant &variant);
+    void sendGenericProperty(const QString &name, const QVariant &variant);
     void sendOnScreenVisibllity(bool visible);
 
     void setSubSurface(ExtendedSurface *subSurface,int x, int y);
index 107a726..be2eb14 100644 (file)
@@ -607,8 +607,7 @@ void Surface::setWindowProperty(const QString &name, const QVariant &value, bool
     d->windowProperties.insert(name, value);
     handle()->windowPropertyChanged(name,value);
     if (writeUpdateToClient && d->extendedSurface) {
-        const char *property = qPrintable(name);
-        d->extendedSurface->sendGenericProperty(property,value);
+        d->extendedSurface->sendGenericProperty(name, value);
     }
 }