If V370 Photo is connected, the application crashes while constructing device selection dialog with std::logic_error, because it attempts to construct std::string from a NULL pointer.
Edit: got over it with the patch, but it still doesn't work. Probably connection string must be fixed as well, not only the display string.
diff --git a/src/Standalone/deviceselectorcombobox.cpp b/src/Standalone/deviceselectorcombobox.cpp
index 0404644..05ad916 100755
--- a/src/Standalone/deviceselectorcombobox.cpp
+++ b/src/Standalone/deviceselectorcombobox.cpp
@@ -98,27 +98,15 @@ void DeviceSelectorCombobox::CreateDisplayName(char displayName[MAX_DISPLAYNAME]
{
char *displayDeviceName = NULL;
char temp_displayName[MAX_DISPLAYNAME];
- bool find = false;
memcpy_s(temp_displayName, MAX_DISPLAYNAME, displayName, strlen(displayName)+1);
- std::string connection_display = connection;
- if(strncmp(connection, "USB", 3) == 0){
- for (int i = 0; i < sizeof(temp_displayName) / sizeof(temp_displayName[0]); i++) {
- if (temp_displayName[i] == ':') {
- find = true;
- }
- }
- if(find && strtok(temp_displayName, ":")){
- std::string serialNumber = strtok(NULL, ":");
- connection_display = connection_display + ":" + serialNumber;
- }
- }
+ std::string connection_display = connection ? connection : "<NULL>";
#ifdef AKBMODE
int connection_str_size = strlen(temp_displayName) + strlen(" (") + strlen(connection_display.c_str()) + strlen(")") + 1;
#else
int connection_str_size = strlen("EPSON ") + strlen(temp_displayName) + strlen(" (") + strlen(connection_display.c_str()) + strlen(")") + 1;
#endif
if(!displayDeviceName){
- displayDeviceName = (char *)malloc(connection_str_size);
+ displayDeviceName = (char *)malloc(connection_str_size);
if(displayDeviceName){
memset(displayDeviceName, 0, connection_str_size);
#ifdef AKBMODE
diff --git a/src/Standalone/initdeviceselectcombobox.cpp b/src/Standalone/initdeviceselectcombobox.cpp
index dc7650b..11f8a96 100755
--- a/src/Standalone/initdeviceselectcombobox.cpp
+++ b/src/Standalone/initdeviceselectcombobox.cpp
@@ -88,20 +88,8 @@ void InitDeviceSelectCombobox::CreateDisplayName(char displayName[MAX_DISPLAYNAM
{
char *displayDeviceName = NULL;
char temp_displayName[MAX_DISPLAYNAME];
- bool find = false;
memcpy_s(temp_displayName, MAX_DISPLAYNAME, displayName, strlen(displayName)+1);
- std::string connection_display = connection;
- if(strncmp(connection, "USB", 3) == 0){
- for (int i = 0; i < sizeof(temp_displayName) / sizeof(temp_displayName[0]); i++) {
- if (temp_displayName[i] == ':') {
- find = true;
- }
- }
- if(find && strtok(temp_displayName, ":")){
- std::string serialNumber = strtok(NULL, ":");
- connection_display = connection_display + ":" + serialNumber;
- }
- }
+ std::string connection_display = connection ? connection : "<NULL>";
#ifdef AKBMODE
int connection_str_size = strlen(temp_displayName) + strlen(" (") + strlen(connection_display.c_str()) + strlen(")") + 1;
#else
Pinned Comments
tecnotercio commented on 2022-09-05 03:32 (UTC)
If you have a problem with Epson Scan 2, check if you need to install another backend for your scanner. More information on the Arch Linux wiki:
https://wiki.archlinux.org/title/SANE/Scanner-specific_problems#Epson