From 14f983e6c519e33692b8c5f5ee872b28442f4383 Mon Sep 17 00:00:00 2001 From: Kinshuk Bairagi Date: Mon, 30 May 2022 11:20:17 +0530 Subject: [PATCH 1/4] osx: Fix segfault at GetPhone GetPhone() handle nullptr of httpServer, before init of config --- tinyphone-osx/Tinyphone.xcodeproj/project.pbxproj | 8 ++++---- tinyphone/baseapp.cpp | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tinyphone-osx/Tinyphone.xcodeproj/project.pbxproj b/tinyphone-osx/Tinyphone.xcodeproj/project.pbxproj index 60becce..6fcb23b 100644 --- a/tinyphone-osx/Tinyphone.xcodeproj/project.pbxproj +++ b/tinyphone-osx/Tinyphone.xcodeproj/project.pbxproj @@ -102,9 +102,9 @@ B327CB532551A2FD0092FDB7 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; B337E2C32554468C001696B7 /* config.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = config.json; path = ../config.json; sourceTree = ""; }; B33839082551D3EF000D6F04 /* osxapp.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = osxapp.cpp; sourceTree = ""; }; - B36B645927E30DB000B011C9 /* libopencore-amrnb.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libopencore-amrnb.0.dylib"; path = "/usr/local/opt/opencore-amr/lib/libopencore-amrnb.0.dylib"; sourceTree = ""; }; - B36B645A27E30DB000B011C9 /* libopencore-amrwb.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libopencore-amrwb.0.dylib"; path = "/usr/local/opt/opencore-amr/lib/libopencore-amrwb.0.dylib"; sourceTree = ""; }; - B392C7B8255412560068492F /* libcryptopp.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcryptopp.dylib; path = /usr/local/opt/cryptopp/lib/libcryptopp.dylib; sourceTree = ""; }; + B36B645927E30DB000B011C9 /* libopencore-amrnb.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libopencore-amrnb.0.dylib"; path = "/usr/local/homebrew/lib/libopencore-amrnb.0.dylib"; sourceTree = ""; }; + B36B645A27E30DB000B011C9 /* libopencore-amrwb.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libopencore-amrwb.0.dylib"; path = "/usr/local/homebrew/lib/libopencore-amrwb.0.dylib"; sourceTree = ""; }; + B392C7B8255412560068492F /* libcryptopp.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcryptopp.dylib; path = /usr/local/homebrew/lib/libcryptopp.dylib; sourceTree = ""; }; B39C3B432552C3CE00BBD999 /* libresolv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.tbd; path = usr/lib/libresolv.tbd; sourceTree = SDKROOT; }; B39C3B4A2552E1E700BBD999 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; B39C3B562552EF1900BBD999 /* Tinyphone-C-Interface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Tinyphone-C-Interface.h"; sourceTree = ""; }; @@ -620,7 +620,7 @@ LIBRARY_SEARCH_PATHS = ( "../lib/statsd-cpp/build-osx/lib", "$(inherited)", - "/usr/local/opt/opencore-amr/lib", + /usr/local/homebrew/lib/, /usr/local/lib, ); MACOSX_DEPLOYMENT_TARGET = 10.15; diff --git a/tinyphone/baseapp.cpp b/tinyphone/baseapp.cpp index 83fce6d..8f5eaeb 100644 --- a/tinyphone/baseapp.cpp +++ b/tinyphone/baseapp.cpp @@ -190,7 +190,10 @@ namespace tp { } TinyPhone* GetPhone(){ - return tp::tpHttpServer->tinyPhone; + if (tp::tpHttpServer != nullptr) + return tp::tpHttpServer->tinyPhone; + else + return nullptr; } From 8bc9410bd61dbdbf9fa0ee5027bcdd4132ac5d23 Mon Sep 17 00:00:00 2001 From: Kinshuk Bairagi Date: Mon, 30 May 2022 12:09:07 +0530 Subject: [PATCH 2/4] Update project.pbxproj --- tinyphone-osx/Tinyphone.xcodeproj/project.pbxproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tinyphone-osx/Tinyphone.xcodeproj/project.pbxproj b/tinyphone-osx/Tinyphone.xcodeproj/project.pbxproj index 6fcb23b..d9d1ee6 100644 --- a/tinyphone-osx/Tinyphone.xcodeproj/project.pbxproj +++ b/tinyphone-osx/Tinyphone.xcodeproj/project.pbxproj @@ -102,9 +102,9 @@ B327CB532551A2FD0092FDB7 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; B337E2C32554468C001696B7 /* config.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = config.json; path = ../config.json; sourceTree = ""; }; B33839082551D3EF000D6F04 /* osxapp.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = osxapp.cpp; sourceTree = ""; }; - B36B645927E30DB000B011C9 /* libopencore-amrnb.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libopencore-amrnb.0.dylib"; path = "/usr/local/homebrew/lib/libopencore-amrnb.0.dylib"; sourceTree = ""; }; - B36B645A27E30DB000B011C9 /* libopencore-amrwb.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libopencore-amrwb.0.dylib"; path = "/usr/local/homebrew/lib/libopencore-amrwb.0.dylib"; sourceTree = ""; }; - B392C7B8255412560068492F /* libcryptopp.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcryptopp.dylib; path = /usr/local/homebrew/lib/libcryptopp.dylib; sourceTree = ""; }; + B36B645927E30DB000B011C9 /* libopencore-amrnb.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libopencore-amrnb.0.dylib"; path = "/usr/local/homebrew/opt/opencore-amr/lib/libopencore-amrnb.0.dylib"; sourceTree = ""; }; + B36B645A27E30DB000B011C9 /* libopencore-amrwb.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libopencore-amrwb.0.dylib"; path = "/usr/local/homebrew/opt/opencore-amr/lib/libopencore-amrwb.0.dylib"; sourceTree = ""; }; + B392C7B8255412560068492F /* libcryptopp.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcryptopp.dylib; path = /usr/local/homebrew/opt/cryptopp/lib/libcryptopp.dylib; sourceTree = ""; }; B39C3B432552C3CE00BBD999 /* libresolv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.tbd; path = usr/lib/libresolv.tbd; sourceTree = SDKROOT; }; B39C3B4A2552E1E700BBD999 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; B39C3B562552EF1900BBD999 /* Tinyphone-C-Interface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Tinyphone-C-Interface.h"; sourceTree = ""; }; From 854cf4e5f2d0960975eea22ac5414599e190632a Mon Sep 17 00:00:00 2001 From: Kinshuk Bairagi Date: Mon, 30 May 2022 13:54:49 +0530 Subject: [PATCH 3/4] Update main.yml --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b6d7521..0d2e980 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -126,6 +126,7 @@ jobs: wget https://gist.githubusercontent.com/kingster/1954ead3c38a40cac88c5c1311bb39c5/raw/343da2c7a2a52ee5a1c03902cc5e44ed83b1dd5d/cryptopp.rb brew install --build-from-source -f cryptopp.rb npm install -g appdmg + ln -s /usr/local/opt /usr/local/homebrew/opt - name: Compile Libraries run : | From e164afb6363f2a57ee52637fac2729855e86918f Mon Sep 17 00:00:00 2001 From: Kinshuk Bairagi Date: Mon, 30 May 2022 16:32:09 +0530 Subject: [PATCH 4/4] fixes --- .github/workflows/main.yml | 1 - tinyphone-osx/Tinyphone.xcodeproj/project.pbxproj | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0d2e980..b6d7521 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -126,7 +126,6 @@ jobs: wget https://gist.githubusercontent.com/kingster/1954ead3c38a40cac88c5c1311bb39c5/raw/343da2c7a2a52ee5a1c03902cc5e44ed83b1dd5d/cryptopp.rb brew install --build-from-source -f cryptopp.rb npm install -g appdmg - ln -s /usr/local/opt /usr/local/homebrew/opt - name: Compile Libraries run : | diff --git a/tinyphone-osx/Tinyphone.xcodeproj/project.pbxproj b/tinyphone-osx/Tinyphone.xcodeproj/project.pbxproj index d9d1ee6..1c9ff3d 100644 --- a/tinyphone-osx/Tinyphone.xcodeproj/project.pbxproj +++ b/tinyphone-osx/Tinyphone.xcodeproj/project.pbxproj @@ -102,9 +102,9 @@ B327CB532551A2FD0092FDB7 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; B337E2C32554468C001696B7 /* config.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = config.json; path = ../config.json; sourceTree = ""; }; B33839082551D3EF000D6F04 /* osxapp.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = osxapp.cpp; sourceTree = ""; }; - B36B645927E30DB000B011C9 /* libopencore-amrnb.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libopencore-amrnb.0.dylib"; path = "/usr/local/homebrew/opt/opencore-amr/lib/libopencore-amrnb.0.dylib"; sourceTree = ""; }; - B36B645A27E30DB000B011C9 /* libopencore-amrwb.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libopencore-amrwb.0.dylib"; path = "/usr/local/homebrew/opt/opencore-amr/lib/libopencore-amrwb.0.dylib"; sourceTree = ""; }; - B392C7B8255412560068492F /* libcryptopp.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcryptopp.dylib; path = /usr/local/homebrew/opt/cryptopp/lib/libcryptopp.dylib; sourceTree = ""; }; + B36B645927E30DB000B011C9 /* libopencore-amrnb.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libopencore-amrnb.0.dylib"; path = "/usr/local/opt/opencore-amr/lib/libopencore-amrnb.0.dylib"; sourceTree = ""; }; + B36B645A27E30DB000B011C9 /* libopencore-amrwb.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libopencore-amrwb.0.dylib"; path = "/usr/local/opt/opencore-amr/lib/libopencore-amrwb.0.dylib"; sourceTree = ""; }; + B392C7B8255412560068492F /* libcryptopp.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcryptopp.dylib; path = /usr/local/opt/cryptopp/lib/libcryptopp.dylib; sourceTree = ""; }; B39C3B432552C3CE00BBD999 /* libresolv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.tbd; path = usr/lib/libresolv.tbd; sourceTree = SDKROOT; }; B39C3B4A2552E1E700BBD999 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; B39C3B562552EF1900BBD999 /* Tinyphone-C-Interface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Tinyphone-C-Interface.h"; sourceTree = ""; };