Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package nwg-launchers for openSUSE:Factory 
checked in at 2021-09-27 20:08:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/nwg-launchers (Old)
 and      /work/SRC/openSUSE:Factory/.nwg-launchers.new.1899 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "nwg-launchers"

Mon Sep 27 20:08:46 2021 rev:11 rq:921535 version:0.6.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/nwg-launchers/nwg-launchers.changes      
2021-09-17 23:26:31.329266710 +0200
+++ /work/SRC/openSUSE:Factory/.nwg-launchers.new.1899/nwg-launchers.changes    
2021-09-27 20:08:55.706463447 +0200
@@ -1,0 +2,20 @@
+Sun Sep 26 21:14:46 UTC 2021 - Michael Vetter <[email protected]>
+
+- Update to 0.6.3:
+  * This release fixes builds with libc++ < 11 (#187)
+
+-------------------------------------------------------------------
+Sun Sep 26 21:13:58 UTC 2021 - Michael Vetter <[email protected]>
+
+- Update to 0.6.2:
+  * nwgbar contents can be scrolled (#182);
+  * max icon size is increased up to 2048 (#180);
+  * fixed broken pins ordering (#176);
+  * fixed nwggrid spawning server with messed up arguments;
+  * launchers will no longer fail to start after being improperly closed
+    (e.g. SIGKILL) (#178);
+  * nwggrid prints an error if started with -p or -f and -d at the same
+    time;
+  * fixed potential data race when accessing pid file.
+
+-------------------------------------------------------------------

Old:
----
  v0.6.1.tar.gz

New:
----
  v0.6.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ nwg-launchers.spec ++++++
--- /var/tmp/diff_new_pack.3f3A30/_old  2021-09-27 20:08:56.434464249 +0200
+++ /var/tmp/diff_new_pack.3f3A30/_new  2021-09-27 20:08:56.438464254 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           nwg-launchers
-Version:        0.6.1
+Version:        0.6.3
 Release:        0
 Summary:        GTK launchers and menu for sway and i3
 License:        GPL-3.0-or-later

++++++ v0.6.1.tar.gz -> v0.6.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nwg-launchers-0.6.1/README.md 
new/nwg-launchers-0.6.3/README.md
--- old/nwg-launchers-0.6.1/README.md   2021-09-17 10:41:57.000000000 +0200
+++ new/nwg-launchers-0.6.3/README.md   2021-09-26 03:38:54.000000000 +0200
@@ -6,9 +6,8 @@
 ## This project is community-driven
 
 As it seems I'm not going to live long enough to learn C++ properly, I decided 
to develop my launchers from scratch in Go. You'll find them in the
-[nwg-shell](https://github.com/nwg-piotr/nwg-shell) project. They only support 
sway, and partially other wlroots-based compositors. The nwg-launchers code
-is a community-driven project from now on, if it comes to further development. 
I'll only support bug fixes, if any.
-
+[nwg-shell](https://github.com/nwg-piotr/nwg-shell) project. They only support 
sway, and partially other wlroots-based compositors. Nwg-launchers 
+is a community-driven project from now on. The main developer is 
[Siborgium](https://github.com/Siborgium).
 ## Description
 
 It's damned difficult to make all the stuff behave properly on all window 
managers. My priorities are:
@@ -34,9 +33,12 @@
 
 ### Dependencies
 
-- `gtkmm3` (`libgtkmm-3.0-dev`)
-- `meson` and `ninja` - build dependencies
+##### Build dependencies
+- `meson` and `ninja`
 - `nlohmann-json` - will be downloaded as a subproject if not found on the 
system
+
+##### Runtime dependencies
+- `gtkmm3` (`libgtkmm-3.0-dev`)
 - `gtk-layer-shell` - optional, set to `auto` by default; will be downloaded 
as a subproject if explicitly enabled, but not found on the system
 - `librsvg` - optional, required to support SVG icons
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nwg-launchers-0.6.1/bar/bar.h 
new/nwg-launchers-0.6.3/bar/bar.h
--- old/nwg-launchers-0.6.1/bar/bar.h   2021-09-17 10:41:57.000000000 +0200
+++ new/nwg-launchers-0.6.3/bar/bar.h   2021-09-26 03:38:54.000000000 +0200
@@ -37,11 +37,12 @@
     public:
         BarWindow(Config&);
 
-        Gtk::VBox outer_box;
-        Gtk::HBox inner_hbox;
-        Gtk::Grid grid;                         // Buttons grid
-        Gtk::Separator separator;               // between favs and all apps
-        std::vector<BarBox> boxes {};           // attached to favs_grid
+        Gtk::ScrolledWindow scrolled_window;
+        Gtk::VBox           outer_box;
+        Gtk::HBox           inner_hbox;
+        Gtk::Grid           grid;            // Buttons grid
+        Gtk::Separator      separator;       // between favs and all apps
+        std::vector<BarBox> boxes {};        // attached to favs_grid
 
     private:
         //Override default signal handler:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nwg-launchers-0.6.1/bar/bar_classes.cc 
new/nwg-launchers-0.6.3/bar/bar_classes.cc
--- old/nwg-launchers-0.6.1/bar/bar_classes.cc  2021-09-17 10:41:57.000000000 
+0200
+++ new/nwg-launchers-0.6.3/bar/bar_classes.cc  2021-09-26 03:38:54.000000000 
+0200
@@ -30,19 +30,19 @@
     if (auto i_size = parser.getCmdOption("-s"); !i_size.empty()) {
         int i_s;
         if (parse_number(i_size, i_s)) {
-            if (i_s >= 16 && i_s <= 256) {
+            if (i_s >= 16 && i_s <= 2048) {
                 icon_size = i_s;
             } else {
-                Log::error("Size must be in range 16 - 256\n");
+                Log::error("Size must be in range 16 - 2048\n");
             }
         } else {
-            Log::error("Image size should be valid integer in range 16 - 
256\n");
+            Log::error("Image size should be valid integer in range 16 - 
2048\n");
         }
     }
 }
 
 BarWindow::BarWindow(Config& config): PlatformWindow(config) {
-    // outer_box -> inner_hbox -> grid
+    // scrolled_window -> outer_box -> inner_hbox -> grid
     grid.set_column_spacing(5);
     grid.set_row_spacing(5);
     grid.set_column_homogeneous(true);
@@ -58,7 +58,8 @@
         case VAlign::Bottom: outer_box.pack_end(inner_hbox, false, false); 
break;
         default: outer_box.pack_start(inner_hbox, Gtk::PACK_EXPAND_PADDING);
     }
-    add(outer_box);
+    scrolled_window.add(outer_box);
+    add(scrolled_window);
     show_all_children();
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nwg-launchers-0.6.1/common/meson.build 
new/nwg-launchers-0.6.3/common/meson.build
--- old/nwg-launchers-0.6.1/common/meson.build  2021-09-17 10:41:57.000000000 
+0200
+++ new/nwg-launchers-0.6.3/common/meson.build  2021-09-26 03:38:54.000000000 
+0200
@@ -1,6 +1,7 @@
 sources = files(
        'nwg_tools.cc',
-       'nwg_classes.cc'
+       'nwg_classes.cc',
+       'nwg_exceptions.cc'
 )
 
 nwg_inc = include_directories('.')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nwg-launchers-0.6.1/common/nwg_classes.cc 
new/nwg-launchers-0.6.3/common/nwg_classes.cc
--- old/nwg-launchers-0.6.1/common/nwg_classes.cc       2021-09-17 
10:41:57.000000000 +0200
+++ new/nwg-launchers-0.6.3/common/nwg_classes.cc       2021-09-26 
03:38:54.000000000 +0200
@@ -19,6 +19,7 @@
 #include "charconv-compat.h"
 #include "nwgconfig.h"
 #include "nwg_classes.h"
+#include "nwg_exceptions.h"
 #include "nwg_tools.h"
 
 InputParser::InputParser (int argc, char **argv) {
@@ -161,11 +162,11 @@
     pid_lock_fd = open(lock_file.c_str(), O_CLOEXEC | O_CREAT | O_WRONLY, 
S_IWUSR | S_IRUSR);
     if (pid_lock_fd < 0) {
         int err = errno;
-        throw std::runtime_error{ concat("failed to open pid lock: ", 
error_description(err)) };
+        throw ErrnoException{ "failed to open pid lock: ", err };
     }
 
     // let's try to read pid file
-    if (auto pid = get_instance_pid(pid_file)) {
+    if (auto pid = get_instance_pid(pid_file.c_str())) {
         Log::info("Another instance is running, trying to terminate it...");
         if (kill(*pid, SIGTERM) != 0) {
             throw std::runtime_error{ "failed to send SIGTERM to pid" };
@@ -177,14 +178,11 @@
     // we'll hold this lock until the very exit
     if (lockf(pid_lock_fd, F_LOCK, 0)) {
         int err = errno;
-        throw std::runtime_error{ concat("failed to lock the pid lock: ", 
error_description(err)) };
+        throw ErrnoException{ "failed to lock the pid lock: ", err };
     }
 
     // write instance pid
-    std::ofstream pid_stream{ pid_file, std::ios::trunc };
-    auto pid = getpid();
-    pid_stream << pid;
-    pid_stream.flush();
+    write_instance_pid(pid_file.c_str(), getpid());
 
     // using glib unix extensions instead of plain signals allows for 
arbitrary functions to be used
     // when handling signals
@@ -214,15 +212,28 @@
 
 IconProvider::IconProvider(const Glib::RefPtr<Gtk::IconTheme>& theme, int 
icon_size):
     icon_theme{ theme },
-    fallback{ Gdk::Pixbuf::create_from_file(
-        DATA_DIR_STR "/icon-missing" ICON_EXT,
-        icon_size,
-        icon_size,
-        true
-    ) },
     icon_size{ icon_size }
 {
-    // intentionally left blank
+    constexpr std::array fallback_icons {
+        DATA_DIR_STR "/icon-missing.svg",
+        DATA_DIR_STR "/icon-missing.png"
+    };
+    for (auto && icon: fallback_icons) {
+        try {
+            fallback = Gdk::Pixbuf::create_from_file(
+                icon,
+                icon_size,
+                icon_size,
+                true
+            );
+            break;
+        } catch (const Glib::Error& e) {
+            Log::error("Failed to load fallback icon '", icon, "'");
+        }
+    }
+    if (!fallback) {
+        throw std::runtime_error{ "No fallback icon available" };
+    }
 }
 
 Gtk::Image IconProvider::load_icon(const std::string& icon) const {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nwg-launchers-0.6.1/common/nwg_classes.h 
new/nwg-launchers-0.6.3/common/nwg_classes.h
--- old/nwg-launchers-0.6.1/common/nwg_classes.h        2021-09-17 
10:41:57.000000000 +0200
+++ new/nwg-launchers-0.6.3/common/nwg_classes.h        2021-09-26 
03:38:54.000000000 +0200
@@ -143,6 +143,8 @@
 
     Instance(Gtk::Application& app, std::string_view name);
     virtual ~Instance();
+    // note: the provided implementation of on_{sigterm,sigint} handlers
+    // calls Gtk::Application::quit, which does NOT call any destructors
     virtual void on_sigterm();
     virtual void on_sigusr1();
     virtual void on_sighup();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nwg-launchers-0.6.1/common/nwg_exceptions.cc 
new/nwg-launchers-0.6.3/common/nwg_exceptions.cc
--- old/nwg-launchers-0.6.1/common/nwg_exceptions.cc    1970-01-01 
01:00:00.000000000 +0100
+++ new/nwg-launchers-0.6.3/common/nwg_exceptions.cc    2021-09-26 
03:38:54.000000000 +0200
@@ -0,0 +1,23 @@
+
+/*
+ * Exception classes for nwg-launchers
+ * Copyright (c) 2021 Piotr Miller
+ * e-mail: [email protected]
+ * Website: http://nwg.pl
+ * Project: https://github.com/nwg-piotr/nwg-launchers
+ * License: GPL3
+ * */
+
+
+#include <cerrno>
+#include <cstring>
+#include "nwg_exceptions.h"
+
+std::string error_description(int err) {
+    errno = 0;
+    auto cstr = std::strerror(err);
+    if (!cstr || errno) {
+        throw std::runtime_error{ "failed to retrieve errno description: 
strerror return NULL" };
+    }
+    return { cstr };
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nwg-launchers-0.6.1/common/nwg_exceptions.h 
new/nwg-launchers-0.6.3/common/nwg_exceptions.h
--- old/nwg-launchers-0.6.1/common/nwg_exceptions.h     1970-01-01 
01:00:00.000000000 +0100
+++ new/nwg-launchers-0.6.3/common/nwg_exceptions.h     2021-09-26 
03:38:54.000000000 +0200
@@ -0,0 +1,43 @@
+#pragma once
+
+/*
+ * Exception classes for nwg-launchers
+ * Copyright (c) 2021 Piotr Miller
+ * e-mail: [email protected]
+ * Website: http://nwg.pl
+ * Project: https://github.com/nwg-piotr/nwg-launchers
+ * License: GPL3
+ * */
+
+#include <stdexcept>
+#include <string>
+#include <string_view>
+
+// wraps strerror into std::string
+std::string error_description(int err);
+
+struct ErrnoException: public std::runtime_error {
+    static inline std::string concat(std::string_view a, std::string b) {
+        b.insert(0, a.data(), a.size());
+        return b;
+    }
+    /* Make sure to use this constructor as follows:
+     *
+     *    int err = errno;
+     *    ErrnoException{ "desc", err }
+     *
+     * and NOT
+     *
+     *    ErrnoException{ "desc", errno }
+     *
+     * because creating `string_view` can potentially change `errno` value,
+     * and the initialization order is not guaranteed */
+    ErrnoException(std::string_view desc, int err):
+        std::runtime_error{ concat(desc, error_description(err)) }
+    {
+        // intentionally left blank
+    }
+    ErrnoException(int err): std::runtime_error{ error_description(err) } {
+        // intentionally left blank
+    }
+};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nwg-launchers-0.6.1/common/nwg_tools.cc 
new/nwg-launchers-0.6.3/common/nwg_tools.cc
--- old/nwg-launchers-0.6.1/common/nwg_tools.cc 2021-09-17 10:41:57.000000000 
+0200
+++ new/nwg-launchers-0.6.3/common/nwg_tools.cc 2021-09-26 03:38:54.000000000 
+0200
@@ -9,6 +9,7 @@
  * License: GPL3
  * */
 
+#include <fcntl.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <signal.h>
@@ -20,8 +21,10 @@
 #include <iomanip>
 #include <fstream>
 
+#include "charconv-compat.h"
 #include "filesystem-compat.h"
 #include "nwgconfig.h"
+#include "nwg_exceptions.h"
 #include "nwg_tools.h"
 
 
@@ -99,21 +102,104 @@
     return dir;
 }
 
-std::optional<pid_t> get_instance_pid(const fs::path& pid_file_path) {
-    if (std::ifstream pid_file{ pid_file_path }) {
-        pid_file.exceptions(std::ifstream::badbit | std::ifstream::failbit);
-
-        pid_t pid;
-        pid_file >> pid;
-        if (pid < 0) {
-            throw std::runtime_error{ "pid < 0" };
+/* RAII wrappers to reduce the amount of bookkeeping */
+struct FdGuard {
+    int fd;
+    ~FdGuard() { close(fd); }
+};
+struct LockfGuard {
+    int   fd;
+    off_t len;
+    LockfGuard(int fd, int cmd, off_t len): fd{ fd }, len{ len } {
+        if (lockf(fd, cmd, len)) {
+            int err = errno;
+            throw ErrnoException{ "Failed to lock file: ", err };
+        }
+    }
+    ~LockfGuard() {
+        if (lockf(fd, F_ULOCK, len)) {
+            int err = errno;
+            Log::error("Failed to unlock file: ", error_description(err));
+        }
+    }
+};
+/* private helpers handling partial reads/writes (see {read,write}(2))  */
+static inline size_t read_buf(int fd, char* buf, size_t n) {
+    size_t total{ 0 };
+    while (total < n) {
+        auto bytes = read(fd, buf + total, n - total);
+        if (bytes == 0) {
+            break;
         }
-        if (kill(pid, 0) != 0) {
-            throw std::runtime_error{ "process with specified pid does not 
exist" };
+        if (bytes < 0) {
+            int err = errno;
+            throw ErrnoException{ "read(2) failed: ", err };
+        }
+        total += bytes;
+    }
+    return total;
+}
+static inline void write_buf(int fd, const char* buf, size_t n) {
+    size_t total{ 0 };
+    while (total < n) {
+        auto bytes = write(fd, buf + total, n - total);
+        if (bytes == 0) {
+            break;
         }
-        return pid;
+        if (bytes < 0) {
+            int err = errno;
+            throw ErrnoException{ "write(2) failed: ", err };
+        }
+        total += bytes;
     }
-    return std::nullopt;
+}
+
+std::optional<pid_t> get_instance_pid(const char* path) {
+    // we need write capability to be able to lockf(3) file
+    auto fd = open(path, O_RDWR | O_CLOEXEC, 0);
+    if (fd == -1) {
+        int err = errno;
+        if (err == ENOENT) {
+            return std::nullopt;
+        }
+        throw ErrnoException{ "failed to open pid file: ", err };
+    }
+    FdGuard fd_guard{ fd };
+    LockfGuard guard{ fd, F_LOCK, 0 };
+
+    // we read at most 64 bytes which is more than enough for pid
+    char buf[64]{};
+    pid_t pid{ -1 };
+    auto bytes = read_buf(fd, buf, 64);
+    if (bytes == 0) {
+        Log::warn("the pid file is empty");
+        return std::nullopt;
+    }
+    std::string_view view{ buf, size_t(bytes) };
+    if (!parse_number(view, pid)) {
+        throw std::runtime_error{ "Failed to read pid from file" };
+    }
+    if (pid < 0) {
+        Log::warn("the saved pid is negative");
+        return std::nullopt;
+    }
+    if (kill(pid, 0) != 0) {
+        Log::warn("the saved pid is stale");
+        return std::nullopt;
+    }
+    return pid;
+}
+
+void write_instance_pid(const char* path, pid_t pid) {
+    auto fd = open(path, O_WRONLY | O_CLOEXEC | O_CREAT, S_IWUSR | S_IRUSR);
+    if (fd == -1) {
+        int err = errno;
+        throw ErrnoException{ "failed to open the pid file: ", err };
+    }
+    FdGuard fd_guard{ fd };
+    LockfGuard guard{ fd, F_LOCK, 0 };
+    auto str = std::to_string(pid);
+    write_buf(fd, str.data(), str.size());
 }
 
 /*
@@ -579,12 +665,3 @@
     static_cast<Instance*>(userdata)->on_sigint();
     return G_SOURCE_CONTINUE;
 }
-
-std::string error_description(int err) {
-    errno = 0;
-    auto cstr = std::strerror(err);
-    if (!cstr || errno) {
-        throw std::runtime_error{ "failed to retrieve errno description: 
strerror return NULL" };
-    }
-    return { cstr };
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nwg-launchers-0.6.1/common/nwg_tools.h 
new/nwg-launchers-0.6.3/common/nwg_tools.h
--- old/nwg-launchers-0.6.1/common/nwg_tools.h  2021-09-17 10:41:57.000000000 
+0200
+++ new/nwg-launchers-0.6.3/common/nwg_tools.h  2021-09-26 03:38:54.000000000 
+0200
@@ -30,8 +30,9 @@
 // returns path to pid file <name>
 fs::path get_pid_file(std::string_view name);
 // returns saved instance pid or nullopt if the file does not exist
-// throws std::runtime_error and std::ios_base::failure
-std::optional<pid_t> get_instance_pid(const fs::path& pid_file_path);
+// throws std::runtime_error
+std::optional<pid_t> get_instance_pid(const char* pid_file_path);
+void write_instance_pid(const char* path, pid_t pid);
 
 std::string detect_wm(const Glib::RefPtr<Gdk::Display>&, const 
Glib::RefPtr<Gdk::Screen>&);
 
@@ -62,9 +63,6 @@
 int instance_on_sighup(void*);
 int instance_on_sigint(void*);
 
-// wraps strerror into std::string
-std::string error_description(int err);
-
 namespace Log {
     template <typename ... Ts>
     void write(std::ostream& out, Ts && ... ts) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nwg-launchers-0.6.1/grid/grid.h 
new/nwg-launchers-0.6.3/grid/grid.h
--- old/nwg-launchers-0.6.1/grid/grid.h 2021-09-17 10:41:57.000000000 +0200
+++ new/nwg-launchers-0.6.3/grid/grid.h 2021-09-26 03:38:54.000000000 +0200
@@ -158,8 +158,9 @@
 
 /* CRTP class providing T::create() -> RefPtr<T> */
 template <typename T> struct Create {
-    static auto create() {
-        auto* ptr = new T{};
+    template <typename ... Ts>
+    static auto create(Ts && ... ts) {
+        auto* ptr = new T{ std::forward<Ts>(ts)... };
         // refptr(ptr) constructor does not increase reference count, but 
~refptr does decrease
         // resulting in refcount < 0
         ptr->reference();
@@ -179,20 +180,31 @@
 class PinnedBoxes: public BoxesModel, public Create<PinnedBoxes> {
     friend struct Create<PinnedBoxes>; // permit Create to access a protected 
constructor
 protected:
-    int monotonic_index = 0;
+    int monotonic_index{ 0 };
     PinnedBoxes(): Glib::ObjectBase(typeid(PinnedBoxes)) {}
 public:
     void add(GridBox& box) override {
         box.entry->stats.pinned = Stats::Pinned;
-        box.entry->stats.position = monotonic_index;
+        // temporary fix for #176
+        // initial indices are set to < 0 so they are not reordered
+        // but we reset them to 0 when erasing, so that when the entry is 
unpinned & pinned again
+        // it receives proper position
+        if (box.entry->stats.position >= 0) {
+            box.entry->stats.position = monotonic_index;
+            ++monotonic_index;
+        }
         auto pos = container_add_sorted(boxes, &box, [](auto* a, auto* b) {
-            return a->entry->stats.position < b->entry->stats.position;
+            return a->entry->stats.position > b->entry->stats.position;
         });
+
         // monotonic index increases each time an entry is pinned
         // ensuring it will appear last
-        ++monotonic_index;
         items_changed(pos, 0, 1);
     }
+    void erase(GridBox& box) override {
+        box.entry->stats.position = 0;
+        BoxesModel::erase(box);
+    }
 };
 
 class FavBoxes: public BoxesModel, public Create<FavBoxes> {
@@ -368,13 +380,18 @@
     {
         // intentionally left blank
     }
-    /* Instance::on_sig{int,term} call Application::quit, which in turn emit 
shutdown signal
-     * However, window.save_cache bound to said event doesn't get called for 
some reason
-     * So we call it ourselves before calling Application::quit */
+    /* Instance on_* handlers call Application::quit
+     * which internally calls _exit, destructors are not called
+     * To handle this problem GridInstance overrides handlers
+     * to call Application::release
+     */
     void on_sighup() override;  // reload
     void on_sigint() override;  // save & exit
     void on_sigterm() override;  // save & exit
     void on_sigusr1() override; // show
+    ~GridInstance() {
+        window.save_cache();
+    }
 };
 
 /*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nwg-launchers-0.6.1/grid/grid_classes.cc 
new/nwg-launchers-0.6.3/grid/grid_classes.cc
--- old/nwg-launchers-0.6.1/grid/grid_classes.cc        2021-09-17 
10:41:57.000000000 +0200
+++ new/nwg-launchers-0.6.3/grid/grid_classes.cc        2021-09-26 
03:38:54.000000000 +0200
@@ -27,8 +27,13 @@
     background_color{ parser.get_background_color(0.9) }
 {
     auto has_custom_paths = parser.cmdOptionExists("-d");
-    favs = parser.cmdOptionExists("-f") && !has_custom_paths;
-    pins = parser.cmdOptionExists("-p") && !has_custom_paths;
+    auto has_favs = parser.cmdOptionExists("-f");
+    auto has_pins = parser.cmdOptionExists("-p");
+    if ((has_favs || has_pins) && has_custom_paths) {
+        Log::error("'-f' and '-p' options are incompatible with '-d ...', 
ignoring '-p' and/or '-f'");
+    }
+    favs = has_favs && !has_custom_paths;
+    pins = has_pins && !has_custom_paths;
 
     if (auto forced_lang = parser.getCmdOption("-l"); !forced_lang.empty()){
         lang = forced_lang;
@@ -61,13 +66,13 @@
     if (auto i_size = parser.getCmdOption("-s"); !i_size.empty()){
         int i_s;
         if (parse_number(i_size, i_s)) {
-            if (i_s >= 16 && i_s <= 256) {
+            if (i_s >= 16 && i_s <= 2048) {
                 icon_size = i_s;
             } else {
-                Log::error("Size must be in range 16 - 256\n");
+                Log::error("Size must be in range 16 - 2048\n");
             }
         } else {
-            Log::error("Invalid image size");
+            Log::error("Image size should be valid integer in range 16 - 
2048\n");
         }
     }
     oneshot = parser.cmdOptionExists("-oneshot");
@@ -486,11 +491,9 @@
 }
 
 void GridInstance::on_sigint() {
-    window.save_cache();
-    Instance::on_sigint();
+    app.release();
 }
 
 void GridInstance::on_sigterm() {
-    window.save_cache();
-    Instance::on_sigterm();
+    app.release();
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nwg-launchers-0.6.1/grid/grid_client.cc 
new/nwg-launchers-0.6.3/grid/grid_client.cc
--- old/nwg-launchers-0.6.1/grid/grid_client.cc 2021-09-17 10:41:57.000000000 
+0200
+++ new/nwg-launchers-0.6.3/grid/grid_client.cc 2021-09-26 03:38:54.000000000 
+0200
@@ -12,6 +12,7 @@
 #include <vector>
 
 #include "nwg_tools.h"
+#include "nwg_exceptions.h"
 #include "nwgconfig.h"
 
 const char* const HELP_MESSAGE = "\
@@ -42,7 +43,7 @@
                 if (argc != 2) {
                     Log::warn("Arguments after '-client' must be passed to 
nwggrid-server");
                 }
-                auto pid = get_instance_pid(pid_file);
+                auto pid = get_instance_pid(pid_file.c_str());
                 if (!pid) {
                     throw std::runtime_error{ "nwggrid-server is not running" 
};
                 }
@@ -55,23 +56,28 @@
         }
         char path[] = INSTALL_PREFIX_STR "/bin/nwggrid-server";
         char oneshot[] = "-oneshot";
-        std::vector<std::string> string_store;
-        std::vector<char*> arguments;
-        arguments.push_back(path);
-        arguments.push_back(oneshot);
+        auto arguments = new char*[argc + 2];
+        arguments[0] = path;
         for (int i = 1; i < argc; ++i) {
-            auto & arg = string_store.emplace_back(argv[i]);
-            arguments.push_back(arg.data());
+            arguments[i] = strdup(argv[i]);
+            if (!arguments[i]) {
+                int err = errno;
+                // totally unnecessary cleanup, but why not?
+                for (int j = 0; j < i; ++j) {
+                    free(arguments[j]);
+                }
+                throw std::runtime_error{ error_description(err) };
+            }
         }
-        arguments.push_back(nullptr);
+        arguments[argc] = oneshot;
+        arguments[argc + 1] = (char*)NULL;
 
         auto r = execv(
             INSTALL_PREFIX_STR "/bin/nwggrid-server",
-            arguments.data()
+            arguments
         );
         if (r == -1) {
-            int err = errno;
-            throw std::runtime_error{ error_description(err) };
+            throw ErrnoException{ errno };
         }
         return EXIT_SUCCESS;
     } catch (const Glib::Error& err) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nwg-launchers-0.6.1/grid/grid_entries.h 
new/nwg-launchers-0.6.3/grid/grid_entries.h
--- old/nwg-launchers-0.6.1/grid/grid_entries.h 2021-09-17 10:41:57.000000000 
+0200
+++ new/nwg-launchers-0.6.3/grid/grid_entries.h 2021-09-26 03:38:54.000000000 
+0200
@@ -86,6 +86,9 @@
     void set_entry_stats(Entry& entry) {
         if (auto result = std::find(pins.begin(), pins.end(), 
entry.desktop_id); result != pins.end()) {
             entry.stats.pinned = Stats::Pinned;
+            // temporary fix for #176
+            // see comments to PinnedBoxes class
+            entry.stats.position = (result - pins.begin()) - pins.size() - 1;
         }
         auto cmp = [&entry](auto && fav){ return entry.desktop_id == 
fav.desktop_id; };
         if (auto result = std::find_if(favs.begin(), favs.end(), cmp); result 
!= favs.end()) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nwg-launchers-0.6.1/grid/meson.build 
new/nwg-launchers-0.6.3/grid/meson.build
--- old/nwg-launchers-0.6.1/grid/meson.build    2021-09-17 10:41:57.000000000 
+0200
+++ new/nwg-launchers-0.6.3/grid/meson.build    2021-09-26 03:38:54.000000000 
+0200
@@ -8,7 +8,7 @@
 executable(
        'nwggrid',
        files('grid_client.cc', 'grid_classes.cc', 'grid_tools.cc'),
-       dependencies: [gtkmm, gtk_layer_shell],
+       dependencies: [json, gtkmm, gtk_layer_shell],
        link_with: nwg,
        include_directories: [nwg_inc, nwg_conf_inc],
        install: true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nwg-launchers-0.6.1/meson.build 
new/nwg-launchers-0.6.3/meson.build
--- old/nwg-launchers-0.6.1/meson.build 2021-09-17 10:41:57.000000000 +0200
+++ new/nwg-launchers-0.6.3/meson.build 2021-09-26 03:38:54.000000000 +0200
@@ -39,19 +39,11 @@
     required: true
 )
 
-## librsvg is required to load .svg
-librsvg = dependency(
-    'librsvg-2.0',
-    version: ['>=2.0.0'],
-    required: get_option('support-svg')
-)
-
 # Generate configuration header
 conf_data = configuration_data()
 conf_data.set('version', meson.project_version())
 conf_data.set('prefix', get_option('prefix'))
 conf_data.set('datadir', get_option('prefix') / get_option('datadir') / 
'nwg-launchers')
-conf_data.set('SUPPORTS_SVG', librsvg.found())
 configure_file(
        input : 'nwgconfig.h.in',
        output : 'nwgconfig.h',
@@ -74,11 +66,7 @@
        subdir('grid')
 endif
 
-icons = ['icon-missing.png']
-if librsvg.found()
-    icons += 'icon-missing.svg'
-endif
 install_data(
-    icons,
+    ['icon-missing.svg', 'icon-missing.png'],
     install_dir: conf_data.get('datadir')
 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nwg-launchers-0.6.1/meson_options.txt 
new/nwg-launchers-0.6.3/meson_options.txt
--- old/nwg-launchers-0.6.1/meson_options.txt   2021-09-17 10:41:57.000000000 
+0200
+++ new/nwg-launchers-0.6.3/meson_options.txt   2021-09-26 03:38:54.000000000 
+0200
@@ -3,4 +3,3 @@
 option('grid', type: 'boolean', value: true, description: 'Build the grid 
app.')
 option('layer-shell', type: 'feature', value: 'auto', description: 'Enable 
layer-shell support')
 option('gdk-x11', type: 'feature', value: 'auto', description: 'Use Gdk X11 
API')
-option('support-svg', type: 'feature', value: 'auto', description: 'Support 
svg icons')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nwg-launchers-0.6.1/nwgconfig.h.in 
new/nwg-launchers-0.6.3/nwgconfig.h.in
--- old/nwg-launchers-0.6.1/nwgconfig.h.in      2021-09-17 10:41:57.000000000 
+0200
+++ new/nwg-launchers-0.6.3/nwgconfig.h.in      2021-09-26 03:38:54.000000000 
+0200
@@ -1,10 +1,3 @@
 #define VERSION_STR "@version@"
 #define INSTALL_PREFIX_STR "@prefix@"
 #define DATA_DIR_STR "@datadir@"
-#mesondefine SUPPORTS_SVG
-
-#ifdef SUPPORTS_SVG
-#define ICON_EXT ".svg"
-#else
-#define ICON_EXT ".png"
-#endif

Reply via email to